Ref

From Multi Theft Auto: Wiki
Jump to navigation Jump to search

This function will create a reference to the given argument.

Syntax

int ref( mixed objectToReference )    

Required Arguments

  • objectToReference : The Lua element, which you want to reference

Returns

Returns an int if the reference were successfully created. Returns false if the parameter 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. Since at the moment MTA does not make use of advanced garbage-collector semantics, this function serves little purpose other than leak memory!

See Also