Breakroom is now Sinewave Campus. Book a meeting

SScriptingRuntime

العميلالمكونات
في هذا الصنفGetResource
  1. الدوال
  2. GetResource
  3. CallScriptFunction
  4. Reset
  5. GetPublicVariable
  6. SetPublicVariable
  7. InvokeEvent
  8. الخصائص
  9. Resources
  10. Enabled
  11. ComponentName
  12. GameObject
الأعضاء 10
دالةGetResourceGet the resource by its name and return it.
دالةCallScriptFunctionCall registered script function with specified arguments.
دالةResetReset event members to their initial values.
دالةGetPublicVariableGets the public variable by its name and return it.
دالةSetPublicVariableSet the property to public variable with name "name".
دالةInvokeEventInvokes the event with the name "name".
خاصيةResourcesReturn a list of resource.
خاصيةEnabledWhether the scripting runtime component is Enabled.
خاصيةComponentNameThe name of this component.
خاصيةGameObject–

الدوال​

GetResource​

SResource GetResource(string name)

Get the resource by its name and return it.

المعاملات

الاسمالنوعالقيمة الافتراضية
namestring–

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

SResource

مثال

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.

المعاملات

الاسمالنوعالقيمة الافتراضية
namestring–
argumentsparams DynValue[]–

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

void

مثال

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
Space.Host.ExecutingObject.Script.Reset()

GetPublicVariable​

object GetPublicVariable(string name)

Gets the public variable by its name and return it.

المعاملات

الاسمالنوعالقيمة الافتراضية
namestring–

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

object

مثال

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

المعاملات

الاسمالنوعالقيمة الافتراضية
namestring–
propertyDynValue–
persistentboolfalse

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

void

مثال

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

InvokeEvent​

void InvokeEvent(string name)

Invokes the event with the name "name".

المعاملات

الاسمالنوعالقيمة الافتراضية
namestring–

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

void

مثال

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

الخصائص​

Resourcesللقراءة فقط​

SResource[] Resources {get; }

Return a list of resource.

مثال

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

Enabled​

bool Enabled {get; set; }

Whether the scripting runtime component is Enabled.

مثال

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

ComponentNameللقراءة فقط​

string ComponentName {get; }

The name of this component.

مثال

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

GameObjectللقراءة فقط​

SGameObject GameObject {get; }

مثال

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