Deref: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
No edit summary |
||
Line 1: | Line 1: | ||
__NOTOC__ | __NOTOC__ | ||
{{Server client function}} | {{Server client function}} | ||
This function will take a reference and returns its Lua element. | This function will take a reference obtained by the [[ref]] function and returns its Lua element. | ||
==Syntax== | ==Syntax== | ||
Line 13: | Line 13: | ||
===Returns=== | ===Returns=== | ||
Returns ''mixed'' if the reference were valid. Returns ''false'' if the reference were invalid. | 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== | ==See Also== | ||
{{Utility functions}} | {{Utility functions}} |
Latest revision as of 17:02, 20 October 2021
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
- addDebugHook
- base64Decode
- base64Encode
- debugSleep
- decodeString
- encodeString
- fromJSON
- generateKeyPair
- getColorFromString
- getDevelopmentMode
- getDistanceBetweenPoints2D
- getDistanceBetweenPoints3D
- getEasingValue
- getNetworkStats
- getNetworkUsageData
- getPerformanceStats
- getRealTime
- getTickCount
- getTimerDetails
- getTimers
- getFPSLimit
- getUserdataType
- getVersion
- gettok
- isTransferBoxVisible
- setTransferBoxVisible
- hash
- inspect
- interpolateBetween
- iprint
- isOOPEnabled
- isTimer
- killTimer
- md5
- passwordHash
- passwordVerify
- pregFind
- pregMatch
- pregReplace
- removeDebugHook
- resetTimer
- setDevelopmentMode
- setFPSLimit
- setTimer
- ref
- deref
- sha256
- split
- teaDecode
- teaEncode
- toJSON
- tocolor
- getProcessMemoryStats
- utfChar
- utfCode
- utfLen
- utfSeek
- utfSub
- bitAnd
- bitNot
- bitOr
- bitXor
- bitTest
- bitLRotate
- bitRRotate
- bitLShift
- bitRShift
- bitArShift
- bitExtract
- bitReplace