As I saw in the last Update (03/08/2016) there was a feature called “Pointer values have been introduced”.

Could anyone explain how those are implemented, as I can not find any information about that.

Thanks in advance!

1 Like

There is this thing here but I don’t understand either how I am supposed to point to a Pointer.

local _i, _f, _v, _r, _ri, _rf, _s, _rv, _in =
Citizen.PointerValueInt(), Citizen.PointerValueFloat(), Citizen.PointerValueVector(),
Citizen.ReturnResultAnyway(), Citizen.ResultAsInteger(), Citizen.ResultAsFloat(), Citizen.ResultAsString(), Citizen.ResultAsVector(),

I think there must be a function in the Citizen object to setup a pointer.

Where did you get those functions ? Is there a DB of all Citizen functions?

@Koka its in the top of the native.lua file. I cant find any functions about pointers in the other files at Citizen/scripting/

Not sure at all but
someone might wanna test this:

for a, b, c in FUNCTION_HERE do
use a, b, c here

I’m going to dig up the subject since no topic explains it clearly,

these functions are in fact only there to tell the Citizen.InvokeNative function what type of return it should produce and how to pass it the parameters.

Citizen.PointerValueInt(), Citizen.PointerValueFloat() and Citizen.PointerValueVector() will be processed by Citizen.InvokeNative before calling the Native in question. Citizen.InvokeNative’s C++ code will then create a pointer associated with the type (Int, Float or Vector) and pass it to the Native as a parameter, so that the Native, which needs a pointer to function, will write its values to the address passed by the pointer.
Since in LUA we don’t actually have a pointer, these pointers will be passed to the LUA in the form of LightUserData and will therefore be usable again with Citizen.InvokeNative (simply pass an Int LightUserData in place of Citizen.PointerValueInt(), for example).

The Citizen.ResultAsInteger(), Citizen.ResultAsFloat(), Citizen.ResultAsString() and Citizen.ResultAsVector() functions can be used to specify the type of each return value, after the Native arguments.

Citizen.ReturnResultAnyway() is used to force the return.