-
Notifications
You must be signed in to change notification settings - Fork 0
remote functions
Registers object obj
in the remote object table and returns its reference identifier as a light userdata. The object must have a reference type (i.e. a string, function, table, userdata or thread). The object will be permanently accessible via the identifier and will not be garbage collected. This function can be called multiple times on a single object (returning always the same reference), but the same number of calls to unregister
must be used to remove the object from the table.
Unregisters the object represented by ref
. This function can be called from any Lua instance.
Returns the object represented by ref
and, optionally, unregisters it. If the object comes from the same Lua instance as the caller, it is returned directly. Otherwise, more complex marshalling must occur:
If the object is a string, it is copied to the current Lua instance. If it is a more complex type, a proxy object is created. The proxy traps all operations performed on itself and translates them to the target Lua instance. All arguments, return values or errors are marshalled back and forth in a similar way.
Registering _G
can effectively give full access to all objects in the Lua instance; registering load
can allow calling custom code in the instance (and therefore access any objects as well).
It is not possible to disconnect a proxy. Unregistering the corresponding object will not disallow access to it from other Lua instances, it will simply disallow using get
to obtain the proxy. A proxy dies if it is garbage collected or the remote Lua instance is destroyed.
Returns true
if the object is a proxy to another Lua instance.
Returns true
if the proxy is alive, i.e. the remote Lua instance exists.