wiki.sine.space | sinespace

Scripting/Server/SShared

From wiki.sine.space
Revision as of 14:25, 24 February 2022 by Voidtech (Talk | contribs)

Jump to: navigation, search

Members

SetGlobal

void SetGlobal (string namespace, string key, DynValue value);

Sets a global key to a value. The value can be any object type.

Space.Shared.SetGlobal("com.someNameHere.world", "version", "1.02");


GetGlobal

DynValue GetGlobal (string namespace, string key);

Retrieves a previously set global variable, or returns nil.

local versionValue = Space.Shared.GetGlobal("com.someNameHere.world", "version")


RegisterFunction

void RegisterFunction (string ns, string func, Closure reference);

Makes func into a global function that can be accessed anywhere.

function someFunction(name)

  Space.Log("Hello " .. name);
end

Space.Shared.RegisterFunction("com.someNameHere.world", "func", someFunction);


CallFunction

void CallFunction (string ns, string func, IEnumerable< DynValue > args);

Calls the registered function with the specified arguments.

Space.Shared.CallFunction("com.someNameHere.world", "func",{"Smith"});


RegisterBroadcastFunction

void RegisterBroadcastFunction (string ns, string func, Closure reference);

Makes func into a global function that can be accessed anywhere.

function someFunction(name)

  Space.Log("Hello " .. name);
end

Space.Shared.RegisterBroadcastFunction("com.someNameHere.world", "func", someFunction);



CallBroadcastFunction

int CallBroadcastFunction ((string ns, string func, IEnumerable< DynValue > args);

Calls every registered broadcast function with the specified arguments, and returns the number of calls queued.


UnregisterBroadcastFunction

int UnregisterBroadcastFunction (string ns, string func, Closure reference);

Unregister Broadcast Function.


UnregisterBroadcastFunction

int UnregisterBroadcastFunction (string ns, string func);

Unregister Broadcast Function.


SetSuperGlobal

void SetSuperGlobal (string ns, string key, DynValue value);

Sets a Super global key to a value. The value can be any object type.

Space.Shared.SetSuperGlobal("com.someNameHere.world", "version", "1.02");