Skip to content

Lua Behaviour

Accessible via the Script Global.

This entity inherits from MonoBehaviour, as such inherits some of its members.

NameDescription
Hash : stringSHA512 hash of script text as Base64 string
TypeLabel : stringReturns the script type label
ScriptName : stringName of the script asset
IsScriptInitialized : boolWhether this script instance is initialized or not
MethodDescription
Crash(string) : voidCrashes the script preventing stopping it’s execution (the behaviour still exists)
Destroy(string) : voidDestroys the script, while actually getting rid of the behavior
CallGlobalFunction(string name, arg1, arg2, ...) : value|nil
Call a global function on the LuaBehaviour with the name provided. You can send as many arguments as you want (or even none).
This can used to call global functions on other scripts
Note: If you don’t want other scripts from calling your script’s functions, make them Local
GetGlobalBoolean(string name) : boolean|nilGet the given global boolean variable, or nil if it doesn’t exist.
GetGlobalNumber(string name) : number|nilGet the given global number variable, or nil if it doesn’t exist.
GetGlobalString(string name) : string|nilGet the given global string variable, or nil if it doesn’t exist.
GetGlobalTable(string name) : Table|nilGet the given global table variable, or nil if it doesn’t exist.
GetGlobals() : TableGet a table of all the globals in the script.