Ref

From Multi Theft Auto: Wiki
Revision as of 16:57, 20 October 2021 by Quiret (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
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