# SScriptingRuntime

**الأعضاء** 10

|       |                                           |                                                           |
| ----- | ----------------------------------------- | --------------------------------------------------------- |
| دالة  | [GetResource](#getresource)               | Get the resource by its name and return it.               |
| دالة  | [CallScriptFunction](#callscriptfunction) | Call registered script function with specified arguments. |
| دالة  | [Reset](#reset)                           | Reset event members to their initial values.              |
| دالة  | [GetPublicVariable](#getpublicvariable)   | Gets the public variable by its name and return it.       |
| دالة  | [SetPublicVariable](#setpublicvariable)   | Set the property to public variable with name "name".     |
| دالة  | [InvokeEvent](#invokeevent)               | Invokes the event with the name "name".                   |
| خاصية | [Resources](#resources)                   | Return a list of resource.                                |
| خاصية | [Enabled](#enabled)                       | Whether the scripting runtime component is Enabled.       |
| خاصية | [ComponentName](#componentname)           | The name of this component.                               |
| خاصية | [GameObject](#gameobject)                 | –                                                         |

## الدوال

### GetResource

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

Get the resource by its name and return it.

المعاملات

| الاسم | النوع  | القيمة الافتراضية |
| ----- | ------ | ----------------- |
| name  | string | –                 |

القيم المرجعة

`SResource`

مثال

**Lua**

```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.

المعاملات

| الاسم     | النوع              | القيمة الافتراضية |
| --------- | ------------------ | ----------------- |
| name      | string             | –                 |
| arguments | params DynValue\[] | –                 |

القيم المرجعة

`void`

مثال

**Lua**

```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.

القيم المرجعة

`void`

مثال

**Lua**

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

```

### GetPublicVariable

object GetPublicVariable(string name)

Gets the public variable by its name and return it.

المعاملات

| الاسم | النوع  | القيمة الافتراضية |
| ----- | ------ | ----------------- |
| name  | string | –                 |

القيم المرجعة

`object`

مثال

**Lua**

```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".

المعاملات

| الاسم      | النوع    | القيمة الافتراضية |
| ---------- | -------- | ----------------- |
| name       | string   | –                 |
| property   | DynValue | –                 |
| persistent | bool     | false             |

القيم المرجعة

`void`

مثال

**Lua**

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

```

### InvokeEvent

void InvokeEvent(string name)

Invokes the event with the name "name".

المعاملات

| الاسم | النوع  | القيمة الافتراضية |
| ----- | ------ | ----------------- |
| name  | string | –                 |

القيم المرجعة

`void`

مثال

**Lua**

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

```

## الخصائص

### Resources

[SResource](/docs/ar/scripting/client-scripting-api-reference/types/sresource.md)\[] Resources {get; }

Return a list of resource.

مثال

**Lua**

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

```

### Enabled

bool Enabled {get; set; }

Whether the scripting runtime component is Enabled.

مثال

**Lua**

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

```

### ComponentName

string ComponentName {get; }

The name of this component.

مثال

**Lua**

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

```

### GameObject

[SGameObject](/docs/ar/scripting/client-scripting-api-reference/types/sgameobject.md) GameObject {get; }

مثال

**Lua**

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

```
