# SScriptingRuntime

## Index

### Functions Index

| Function Name                                                                                                                                                                                                             |
| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| SResource [**GetResource** ](#getresource)(string name)                                                                                                                                                                   |
| <p>void <a href="#callscriptfunction"><strong>CallScriptFunction</strong> </a>(string name, params DynValue\[] arguments)<br>void <a href="#callscriptfunction"><strong>CallScriptFunction</strong> </a>(string name)</p> |
| void [**Reset** ](#reset)()                                                                                                                                                                                               |
| object [**GetPublicVariable** ](#getpublicvariable)(string name)                                                                                                                                                          |
| void [**SetPublicVariable** ](#setpublicvariable)(string name, DynValue property, bool persistent=false)                                                                                                                  |
| void [**InvokeEvent** ](#invokeevent)(string name)                                                                                                                                                                        |

### Properties Index

| Property Name                                    |
| ------------------------------------------------ |
| SResource\[] [**Resources** ](#resources)`get`   |
| bool [**Enabled** ](#enabled)`get` `set`         |
| string [**ComponentName**](#componentname) `get` |
| SGameObject [**GameObject** ](#gameobject)`get`  |

## Functions

### GetResource

[SResource](/scripting/client-scripting-api-reference/types/sresource.md) **GetResource** (string name)

*Get the resource by its name and return it.*

| Parameter | Type | Description |
| --------- | ---- | ----------- |
|           |      |             |

{% tabs %}
{% tab title="Lua" %}

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

{% endtab %}
{% endtabs %}

### CallScriptFunction

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

*Call registered script function with specified arguments.*

| Parameter | Type | Description |
| --------- | ---- | ----------- |
|           |      |             |

{% tabs %}
{% tab title="Lua" %}

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

{% endtab %}
{% endtabs %}

### Reset

void **Reset** ()

*Reset event members to their initial values.*

{% tabs %}
{% tab title="Lua" %}

```lua
Space.Host.ExecutingObject.Script.Reset()
```

{% endtab %}
{% endtabs %}

### GetPublicVariable

object **GetPublicVariable** (string name)

*Gets the public variable by its name and return it.*

| Parameter | Type | Description |
| --------- | ---- | ----------- |
|           |      |             |

{% tabs %}
{% tab title="Lua" %}

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

{% endtab %}
{% endtabs %}

### SetPublicVariable

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

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

| Parameter | Type | Description |
| --------- | ---- | ----------- |
|           |      |             |

{% tabs %}
{% tab title="Lua" %}

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

{% endtab %}
{% endtabs %}

### InvokeEvent

void **InvokeEvent** (string name)

*Invokes the event with the name "name".*

| Parameter | Type | Description |
| --------- | ---- | ----------- |
|           |      |             |

{% tabs %}
{% tab title="Lua" %}

```lua
Space.Host.ExecutingObject.Script.InvokeEvent("EventName")
```

{% endtab %}
{% endtabs %}

## Properties

### Resources

[SResource](/scripting/client-scripting-api-reference/types/sresource.md)\[] **Resources** `get`

*Return a list of resource.*

{% tabs %}
{% tab title="Lua" %}

```lua
tableResources = Space.Host.ExecutingObject.Script.Resources
```

{% endtab %}
{% endtabs %}

### Enabled

bool **Enabled** `get` `set`

*Whether the scripting runtime component is Enabled.*

{% tabs %}
{% tab title="Lua" %}

```lua
Space.Host.ExecutingObject.Script.Enabled = true
```

{% endtab %}
{% endtabs %}

### ComponentName

string **ComponentName** `get`

*The name of this component.*

{% tabs %}
{% tab title="Lua" %}

```lua
componentName = Space.Host.ExecutingObject.Script.ComponentName
```

{% endtab %}
{% endtabs %}

### GameObject

[SGameObject](/scripting/client-scripting-api-reference/types/sgameobject.md) **GameObject** `get`

*Property Description*

{% tabs %}
{% tab title="Lua" %}

```lua
theGameObject = Space.Host.ExecutingObject.Script.GameObject
```

{% endtab %}
{% endtabs %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.breakroom.tech/scripting/client-scripting-api-reference/components/sscriptingruntime.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
