Breakroom is now Sinewave Campus. Book a meeting

SScriptingRuntime

ClientComponents
On this classGetResource
  1. Functions
  2. GetResource
  3. CallScriptFunction
  4. Reset
  5. GetPublicVariable
  6. SetPublicVariable
  7. InvokeEvent
  8. Properties
  9. Resources
  10. Enabled
  11. ComponentName
  12. GameObject
Members 10
FunctionGetResourceGet the resource by its name and return it.
FunctionCallScriptFunctionCall registered script function with specified arguments.
FunctionResetReset event members to their initial values.
FunctionGetPublicVariableGets the public variable by its name and return it.
FunctionSetPublicVariableSet the property to public variable with name "name".
FunctionInvokeEventInvokes the event with the name "name".
PropertyResourcesReturn a list of resource.
PropertyEnabledWhether the scripting runtime component is Enabled.
PropertyComponentNameThe name of this component.
PropertyGameObject–

Functions​

GetResource​

SResource GetResource(string name)

Get the resource by its name and return it.

Parameters

NameTypeDefault
namestring–

Returns

SResource

Example

Lua
resource = Space.Host.ExecutingObject.Script.GetResource("resource name")

CallScriptFunction​

void CallScriptFunction(string name, params DynValue[] arguments)
void CallScriptFunction(string name)

Call registered script function with specified arguments.

Parameters

NameTypeDefault
namestring–
argumentsparams DynValue[]–

Returns

void

Example

Lua
resource = Space.Host.ExecutingObject.Script.CallScriptFunction("FunctionName")
--or
resource = Space.Host.ExecutingObject.Script.CallScriptFunction("FunctionName", tableWithArguments)

Reset​

void Reset()

Reset event members to their initial values.

Returns

void

Example

Lua
Space.Host.ExecutingObject.Script.Reset()

GetPublicVariable​

object GetPublicVariable(string name)

Gets the public variable by its name and return it.

Parameters

NameTypeDefault
namestring–

Returns

object

Example

Lua
publicVariable = Space.Host.ExecutingObject.Script.GetPublicVariable("variableName")

SetPublicVariable​

void SetPublicVariable(string name, DynValue property, bool persistent = false)

Set the property to public variable with name "name".

Parameters

NameTypeDefault
namestring–
propertyDynValue–
persistentboolfalse

Returns

void

Example

Lua
Space.Host.ExecutingObject.Script.SetPublicVariable("VariableName",5,true)

InvokeEvent​

void InvokeEvent(string name)

Invokes the event with the name "name".

Parameters

NameTypeDefault
namestring–

Returns

void

Example

Lua
Space.Host.ExecutingObject.Script.InvokeEvent("EventName")

Properties​

ResourcesRead only​

SResource[] Resources {get; }

Return a list of resource.

Example

Lua
tableResources = Space.Host.ExecutingObject.Script.Resources

Enabled​

bool Enabled {get; set; }

Whether the scripting runtime component is Enabled.

Example

Lua
Space.Host.ExecutingObject.Script.Enabled = true

ComponentNameRead only​

string ComponentName {get; }

The name of this component.

Example

Lua
componentName = Space.Host.ExecutingObject.Script.ComponentName

GameObjectRead only​

SGameObject GameObject {get; }

Example

Lua
theGameObject = Space.Host.ExecutingObject.Script.GameObject