SShared
Dans cette classeSetGlobal
| Fonction | SetGlobal | Sets a global key to a value. |
| Fonction | GetGlobal | Retrieves a previously set global variable, or returns nil. |
| Fonction | RegisterFunction | Makes func into a global function that can be accessed anywhere. |
| Fonction | RegisterBroadcastFunction | Makes func into a global function that can be accessed anywhere. |
| Fonction | UnregisterBroadcastFunction | Unregister Broadcast Function. |
| Fonction | CallFunction | Calls the registered function with the specified arguments. |
| Fonction | CallBroadcastFunction | Calls every registered broadcast function with the specified arguments, and returns the number of calls queued. |
Fonctions
SetGlobal
Sets a global key to a value. The value can be any object type.
Paramètres
| Nom | Type | Valeur par défaut |
|---|---|---|
| ns | string | – |
| key | string | – |
| value | DynValue | – |
Valeurs de retour
void
Exemple
Space.Shared.SetGlobal("com.someNameHere.world", "version", "1.02");
GetGlobal
Retrieves a previously set global variable, or returns nil.
Paramètres
| Nom | Type | Valeur par défaut |
|---|---|---|
| ns | string | – |
| key | string | – |
Valeurs de retour
DynValue
Exemple
local versionValue = Space.Shared.GetGlobal("com.someNameHere.world", "version")
RegisterFunction
Makes func into a global function that can be accessed anywhere.
Paramètres
| Nom | Type | Valeur par défaut |
|---|---|---|
| ns | string | – |
| func | string | – |
| reference | Closure | – |
Valeurs de retour
void
Exemple
function someFunction(name)
Space.Log("Hello " .. name);
end
Space.Shared.RegisterFunction("com.someNameHere.world", "func", someFunction);
RegisterBroadcastFunction
Makes func into a global function that can be accessed anywhere.
Paramètres
| Nom | Type | Valeur par défaut |
|---|---|---|
| ns | string | – |
| func | string | – |
| reference | Closure | – |
Valeurs de retour
void
Exemple
function someFunction(name)
Space.Log("Hello " .. name);
end
Space.Shared.RegisterBroadcastFunction("com.someNameHere.world", "func", someFunction);
UnregisterBroadcastFunction
Unregister Broadcast Function.
Paramètres
| Nom | Type | Valeur par défaut |
|---|---|---|
| ns | string | – |
| func | string | – |
| reference | Closure | – |
Valeurs de retour
void
Exemple
example 1
CallFunction
Calls the registered function with the specified arguments.
Paramètres
| Nom | Type | Valeur par défaut |
|---|---|---|
| ns | string | – |
| func | string | – |
| args | IEnumerable< DynValue > | – |
Valeurs de retour
void
Exemple
Space.Shared.CallFunction("com.someNameHere.world", "func",{"Smith"});
CallBroadcastFunction
Calls every registered broadcast function with the specified arguments, and returns the number of calls queued.
Paramètres
| Nom | Type | Valeur par défaut |
|---|---|---|
| ns | string | – |
| func | string | – |
| args | IEnumerable< DynValue > | – |
Valeurs de retour
int
Exemple
example 1



