Breakroom is now Sinewave Campus. Book a meeting

SShared

ServeurRéseau
Dans cette classeSetGlobal
  1. Fonctions
  2. SetGlobal
  3. GetGlobal
  4. RegisterFunction
  5. RegisterBroadcastFunction
  6. UnregisterBroadcastFunction
  7. CallFunction
  8. CallBroadcastFunction
Membres 7
FonctionSetGlobalSets a global key to a value.
FonctionGetGlobalRetrieves a previously set global variable, or returns nil.
FonctionRegisterFunctionMakes func into a global function that can be accessed anywhere.
FonctionRegisterBroadcastFunctionMakes func into a global function that can be accessed anywhere.
FonctionUnregisterBroadcastFunctionUnregister Broadcast Function.
FonctionCallFunctionCalls the registered function with the specified arguments.
FonctionCallBroadcastFunctionCalls every registered broadcast function with the specified arguments, and returns the number of calls queued.

Fonctions​

SetGlobal​

void SetGlobal(string ns, string key, DynValue value)

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

Paramètres

NomTypeValeur par défaut
nsstring–
keystring–
valueDynValue–

Valeurs de retour

void

Exemple

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

GetGlobal​

DynValue GetGlobal(string ns, string key)

Retrieves a previously set global variable, or returns nil.

Paramètres

NomTypeValeur par défaut
nsstring–
keystring–

Valeurs de retour

DynValue

Exemple

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

Paramètres

NomTypeValeur par défaut
nsstring–
funcstring–
referenceClosure–

Valeurs de retour

void

Exemple

Lua
function someFunction(name)
Space.Log("Hello " .. name);
end

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

RegisterBroadcastFunction​

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

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

Paramètres

NomTypeValeur par défaut
nsstring–
funcstring–
referenceClosure–

Valeurs de retour

void

Exemple

Lua
function someFunction(name)
Space.Log("Hello " .. name);
end

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

UnregisterBroadcastFunction​

void UnregisterBroadcastFunction(string ns, string func, Closure reference)
void UnregisterBroadcastFunction(string ns, string func)

Unregister Broadcast Function.

Paramètres

NomTypeValeur par défaut
nsstring–
funcstring–
referenceClosure–

Valeurs de retour

void

Exemple

Lua
example 1

CallFunction​

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

Calls the registered function with the specified arguments.

Paramètres

NomTypeValeur par défaut
nsstring–
funcstring–
argsIEnumerable< DynValue >–

Valeurs de retour

void

Exemple

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

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.

Paramètres

NomTypeValeur par défaut
nsstring–
funcstring–
argsIEnumerable< DynValue >–

Valeurs de retour

int

Exemple

Lua
example 1