Here you have properties and functions available to every script.
Some bindings are provided by dedicated modules. You can access these modules by requiring them in your script.
Function Description require(moduleName)Adding modules to be available to Lua script.
System
UnityEngine
UnityEngine.AI
UnityEngine.UI
CVR
CVR.Network
CVR.CCK
TextMeshPro
RCC
UnityEngine = require ( " UnityEngine " ) -- Access to UnityEngine bindings
CCK = require ( " CVR.CCK " ) -- Access to CCK component bindings
local coolVector = UnityEngine . NewVector3 ( 1 , 2 , 3 )
Function Description IsValid(object) : boolDetermines whether a given System object, Unity Object, or API Object (Like Player or Avatar ) is null or not. It uses Unity’s specific null check for Unity Objects to ensure accurate validation.
Property Description nameAccess to the attached gameObject name. gameObjectAccess to the attached gameObject. transformAccess to the attached transform.
Most MonoBehaviour Events are also available.
Property Description HashSHA512 hash of script text as Base64 string. RunningOnServerTrue when running on server. RunningOnClientTrue when running on client. RunningInAvatarTrue when running on an avatar. RunningInPropTrue when running on a prop. RunningInWorldTrue when running in a world. IsWornByMeDefined when running on an Avatar. True for the avatar wearer. False for others. IsSpawnedByMeDefined when running on a Prop. True for the spawner. False for others. BoundObjectsAccess to the Bound Objects assigned on the CVRLuaClientBehaviour script in editor. ScriptReference to the currently running script. Example: Script.Destroy(“boom”) StorageAccess to the local data persistence system.
API Description Example PlayerAPI Access to the PlayerAPI. Example: PlayerAPI.LocalPlayer.Respawn()InstancesAPI Access to the InstancesAPI. Example: print(InstancesAPI.Ping)AvatarAPI Access to the AvatarAPI. Example: print(AvatarAPI.LocalAvatar)SpawnableAPI Access to the SpawnableAPI. Example: print(#SpawnableAPI.AllSpawnables)WorldAPI Access to the WorldAPI. Example: print(WorldAPI.WorldID)