Deref

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.

This function will take a reference obtained by the ref function and returns its Lua element.

Syntax

mixed deref( int reference )    

Required Arguments

  • reference: The valid reference, which you want to dereference

Returns

Returns mixed if the reference were valid. Returns false if the reference were invalid.

Remarks

This function was originally created to prevent garbage-collection of specific Lua objects/elements which should persist even though no script would reference them. The storage of those references can be obtained by a call to the debug.getregistry function. The ref and deref template can easily be remade using a locally-hidden Lua table and two such function implementations.

See Also