SScriptingRuntime
ClientComponents
On this classGetResource
Members 10
| Function | GetResource | Get the resource by its name and return it. |
| Function | CallScriptFunction | Call registered script function with specified arguments. |
| Function | Reset | Reset event members to their initial values. |
| Function | GetPublicVariable | Gets the public variable by its name and return it. |
| Function | SetPublicVariable | Set the property to public variable with name "name". |
| Function | InvokeEvent | Invokes the event with the name "name". |
| Property | Resources | Return a list of resource. |
| Property | Enabled | Whether the scripting runtime component is Enabled. |
| Property | ComponentName | The name of this component. |
| Property | GameObject | – |
Functions
GetResource
Get the resource by its name and return it.
Parameters
| Name | Type | Default |
|---|---|---|
| name | string | – |
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
| Name | Type | Default |
|---|---|---|
| name | string | – |
| arguments | params 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
| Name | Type | Default |
|---|---|---|
| name | string | – |
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
| Name | Type | Default |
|---|---|---|
| name | string | – |
| property | DynValue | – |
| persistent | bool | false |
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
| Name | Type | Default |
|---|---|---|
| name | string | – |
Returns
void
Example
Lua
Space.Host.ExecutingObject.Script.InvokeEvent("EventName")
Properties
ResourcesRead only
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
Example
Lua
theGameObject = Space.Host.ExecutingObject.Script.GameObject



