Sinespace Client 2025.3.19431
Client-side scripting for Sinespace
SineSpace.Scripting.Components.SScriptingRuntime Class Reference
Inheritance diagram for SineSpace.Scripting.Components.SScriptingRuntime:
ScriptClassComponent< T > ScriptClass< T > ScriptClassWrapper< T > ScriptClass

Public Member Functions

SResource GetResource (string name)
 Get the resource by its name and return it.
 
void CallScriptFunction (string name, params DynValue[] arguments)
 Calls registered script function with specified arguments Function will be called at the start of their next execution context, which may be in the next frame.
 
void CallScriptFunction (string name)
 
void Reset ()
 Resets the event members to their initial values.
 
object GetPublicVariable (string name)
 Gets the public variable by its name and return it.
 
void SetPublicVariable (string name, DynValue property, bool persistent=false)
 Set the property to public variable with name "name" and whether to change persistent.
 
void InvokeEvent (string name)
 Invokes the event with the name "name".
 
- Public Member Functions inherited from ScriptClassWrapper< T >
override void Initialise (SScript runtime, object wrapper)
 
- Public Member Functions inherited from ScriptClass
void ReportError (string error, bool fatal, UnityEngine.Object target=null)
 
void Initialise (SScript runtime, object wrapper)
 

Properties

string ComponentName [get]
 Return the component name of the scripting runtime.
 
SResource[] Resources [get]
 Return a list of resource.
 
bool Enabled [get, set]
 Whether the scriptingRuntime component is enabled or not.
 
- Properties inherited from ScriptClassComponent< T >
SGameObject GameObject [get]
 Return the GameObject which component added.
 
- Properties inherited from ScriptClass< T >
override bool Alive [get]
 Return if the component is alive.
 
- Properties inherited from ScriptClassWrapper< T >
_wrap [get]
 
- Properties inherited from ScriptClass
virtual bool Alive [get]
 
DynValue CachedData [get, set]
 

Additional Inherited Members

- Protected Member Functions inherited from ScriptClass
void Initialise (SScript runtime)
 

Member Function Documentation

◆ CallScriptFunction() [1/2]

void SineSpace.Scripting.Components.SScriptingRuntime.CallScriptFunction ( string name)

◆ CallScriptFunction() [2/2]

void SineSpace.Scripting.Components.SScriptingRuntime.CallScriptFunction ( string name,
params DynValue[] arguments )

Calls registered script function with specified arguments Function will be called at the start of their next execution context, which may be in the next frame.

local thisObject=Space.Host.ExecutingObject
local scripts=thisObject.Script
scripts.CallScriptFunction("Fun","Hello Lua!")
function Fun(a)
Space.Log(a)
&ndash;prints "Hello Lua!"
end
Parameters
nameThe name of function
argumentsThe parameters of the function need

summary> Call registered script function Function will be called at the start of their next execution context, which may be in the next frame. /summary>

local thisObject=Space.Host.ExecutingObject
local scripts=thisObject.Script
scripts.CallScriptFunction("Fun")
function Fun()
local a="Hello Lua!"
Space.Log(a)
&ndash;prints "Hello Lua!"
end

param name="name">The name of function

◆ GetPublicVariable()

object SineSpace.Scripting.Components.SScriptingRuntime.GetPublicVariable ( string name)

Gets the public variable by its name and return it.

local thisObject=Space.Host.ExecutingObject
local scripts=thisObject.Script
local publicVariabl = scripts.GetPublicVariable("no1")
Space.Log(publicVariabl)
Parameters
nameThe name of public variable

◆ GetResource()

SResource SineSpace.Scripting.Components.SScriptingRuntime.GetResource ( string name)

Get the resource by its name and return it.

local thisObject=Space.Host.ExecutingObject
local scripts=thisObject.Script
local getRes=scripts.GetResource("Cube (2)")
Space.Log(getRes.Name)
&ndash;if "Cube (2)" exits, return its name.
Parameters
nameThe name of resource

◆ InvokeEvent()

void SineSpace.Scripting.Components.SScriptingRuntime.InvokeEvent ( string name)

Invokes the event with the name "name".

local thisObject=Space.Host.ExecutingObject
local scripts=thisObject.Script
scripts.InvokeEvent("event1")
function Fun()
a="Hello Lua!"
Space.Log(a) <br>
end
&ndash;prints "Hello Lua!"
Parameters
nameThe name of event

◆ Reset()

void SineSpace.Scripting.Components.SScriptingRuntime.Reset ( )

Resets the event members to their initial values.

local thisObject=Space.Host.ExecutingObject
local scripts=thisObject.Script
scripts.CallScriptFunction("Fun")
function Reset()
scripts.Reset()
end
function Fun()
local a="Hello Lua!"
Space.Log(a)
end
void Reset()
Resets the event members to their initial values.
Definition SScriptingRuntime.cs:126

◆ SetPublicVariable()

void SineSpace.Scripting.Components.SScriptingRuntime.SetPublicVariable ( string name,
DynValue property,
bool persistent = false )

Set the property to public variable with name "name" and whether to change persistent.

local thisObject=Space.Host.ExecutingObject
local scripts=thisObject.Script
scripts.SetPublicVariable("no1","var1",false)
local publicVariabl = scripts.GetPublicVariable("no1")
Space.Log(publicVariabl)
&ndash;set "var1" as "no1" corresponding value
Parameters
nameThe name of public variable
propertyRepresent a value in a Lua/MoonSharp script.
persistentwhether to change persistent

Property Documentation

◆ ComponentName

string SineSpace.Scripting.Components.SScriptingRuntime.ComponentName
get

Return the component name of the scripting runtime.

local thisObject=Space.Host.ExecutingObject
local script=thisObject.Script
Space.Log(script.ComponentName)

◆ Enabled

bool SineSpace.Scripting.Components.SScriptingRuntime.Enabled
getset

Whether the scriptingRuntime component is enabled or not.

local thisObject=Space.Host.ExecutingObject <br>
local scripts=thisObject.Script
Space.Log(scripts.Enabled)

◆ Resources

SResource [] SineSpace.Scripting.Components.SScriptingRuntime.Resources
get

Return a list of resource.

local thisObject=Space.Host.ExecutingObject
local scripts=thisObject.Script
local resources=scripts.Resources
for i = 0, #resources-1 do
Space.Log(resources[i].Name)
end