FrameworkZ 10.8.3
Provides a framework for Project Zomboid with various systems.
Loading...
Searching...
No Matches
FrameworkZ::Foundation Class Reference

Foundation for FrameworkZ. More...

Data Structures

class  Events
 
class  Modules
 Modules for FrameworkZ. Extends the framework with additional functionality. More...
 

Public Member Functions

void AddAllHookHandlers (hookName)
 Add a new hook handler to the list for all categories.
 
void AddChannel (key)
 Add a new channel to the network system. Channels are used to subscribe to; changes in values, or fire events.
 
void AddHookHandler (hookName, category)
 Add a new hook handler to the list.
 
void Broadcast (namespace, key, remove)
 Broadcasts updated or removed data to all clients.
 
void CleanupConfirmations (timeout)
 Cleans up pending confirmations that have not been confirmed within a timeout period.
 
void ClearBatchSyncQueue (isoPlayer)
 Clear the sync queue for a player.
 
void EveryDays ()
 TODO move to shared timer hook.
 
void ExecuteAllHooks (hookName,...)
 Execute all of the hooks.
 
void ExecuteFrameworkHooks (hookName,...)
 Execute the framework hooks.
 
void ExecuteGamemodeHooks (hookName,...)
 Execute the gamemode hooks.
 
void ExecuteGenericHooks (hookName,...)
 Execute generic hooks.
 
void ExecuteHook (hookName, category,...)
 Execute a given hook by its hook name for its given category.
 
void ExecuteModuleHooks (hookName,...)
 Execute module hooks.
 
void ExecutePluginHooks (hookName,...)
 Execute plugin hooks.
 
table Fire (key, data, arguments)
 Fires a callback for a key. This will call the callback for the key with the value supplied.
 
table GetChannel (key)
 Get the channel for a key. This will return the channel data for the key.
 
table GetChannelMeta (key)
 Get the meta data for a channel. This will return the meta data for the key.
 
any GetData (isoPlayer, namespace, keys, subscriptionID, callback)
 Gets a value from a namespace by key(s).
 
void GetLocalData (namespace, keys)
 
object GetModule (moduleName)
 Get a module by name.
 
object GetModuleMetaObject (moduleName)
 Get a module's meta object stored on a module. Not every module will have a meta object. This is a very specific use case and is used for getting instantiable objects such as PLAYER objects or CHARACTER objects.
 
void GetNamespace (namespace)
 Retrieves the entire namespace table.
 
mixed GetNestedValue (root, path)
 Get a nested value from a table using a path. This is used to get values from nested tables.
 
table GetSubscribers (key)
 Get the subscribers for a key. This will return the subscribers for the key.
 
string GetVersion ()
 Get the version of FrameworkZ Foundation.
 
boolean HasChannel (key)
 Check if a channel exists for a key. This will return true if the channel exists, false otherwise.
 
boolean HasSubscription (key, id)
 Check if a subscription exists for a key. This will return true if the subscription exists, false otherwise.
 
void Initialize ()
 Initializes the framework foundation.
 
void InitializeClient (isoPlayer)
 
void InitializePlayer (isoPlayer, playerData, charactersData)
 
void LogChannels ()
 Log all channels and their subscribers to the console. This is useful for debugging and understanding the network system.
 
table New ()
 Create a new instance of the FrameworkZ framework.
 
object NewModule (moduleObject, moduleName)
 Create a new module for the FrameworkZ framework.
 
void OnClientCommand (module, command, isoPlayer, arguments)
 Handles incoming commands from the client on the server.
 
void OnGameStart ()
 Called when the game starts. Executes the OnGameStart function for all modules.
 
void OnGetData (data, namespace, keys, subscriptionID)
 
void OnInitializePlayer (data)
 
void OnRemoveData (data)
 Client receives key removal broadcast.
 
void OnSaveData (data)
 
void OnSaveData (data)
 
void OnSaveNamespace (data)
 
void OnSaveNamespace (data, namespace)
 
void OnServerCommand (module, command, arguments)
 Handles incoming commands from the server on the client.
 
void OnServerStarted ()
 
void OnSetData (data, namespace, keys, value, subscriptionID, broadcast)
 
void OnSync (data)
 Server-side response to client sync request.
 
void OnSyncBroadcast (data)
 Client receives sync data from broadcast.
 
void OnTeleportToLimbo (data)
 
string PathToString (path)
 Convert a path to a string. This is used to convert a table path to a string path.
 
void PostInitializeClient (player)
 
void PreInitializeClient (isoPlayer)
 
void ProcessSaveableData (object, ignoreList, encodeList)
 
void QueueBatchSync (isoPlayer, namespace, key)
 Queue a key in a namespace for sync.
 
void RegisterFramework ()
 Register FrameworkZ. This is called after framework definition.
 
void RegisterFrameworkHandler ()
 Register hook handlers for the framework.
 
void RegisterGamemodeHandler (gamemode)
 Register hook handlers for the gamemode.
 
void RegisterGenericHandler ()
 Register hook handlers for a plugin.
 
void RegisterHandler (hookName, handler, object, functionName, category)
 Register a handler for a hook.
 
void RegisterHandlers (objectOrHandlers, category)
 Register handlers for a specific category.
 
void RegisterModule (module)
 Register a module for FrameworkZ. This is called after module definition.
 
void RegisterModuleHandler (module)
 Register hook handlers for a module.
 
void RegisterNamespace (name)
 Registers a storage namespace, e.g., "Players".
 
void RegisterPluginHandler (plugin)
 Register hook handlers for a plugin.
 
void RemoveChannel (key)
 Remove a channel from the network system. This will remove all subscribers and meta data for the channel.
 
void RemoveData (namespace, key)
 Removes a key from a namespace and broadcasts removal.
 
void RemoveHookHandler (hookName, category)
 Remove a hook handler from the list.
 
void RestoreData (isoPlayer, command, namespace, keys, callback)
 
void RestorePlayer (isoPlayer, player, username, playerData, charactersData)
 
void SaveData (isoPlayer)
 
void SaveNamespace (isoPlayer, namespace)
 
string SendFire (isoPlayer, subscriptionID, callback,...)
 Sends a fire event to the server or client. This is used to send events to subscribers.
 
void SendGet (key, callback, callbackID, broadcast,...)
 Sends a get request to the server.
 
void SendSet (key, value, callback, callbackID, broadcast)
 Sends a set request to the server.
 
void ServerTick ()
 
boolean SetData (isoPlayer, namespace, keys, value, subscriptionID, broadcast, callback)
 Sets a value in a namespace and (optionally) broadcasts to all clients.
 
void SetLocalData (namespace, keys, value)
 
mixed SetNestedValue (root, path, value)
 Set a nested value in a table using a path. This is used to set values in nested tables.
 
void StartBatchSync (isoPlayer, interval, onComplete)
 Begin processing the queued keys for a player.
 
void StartServerTick ()
 
function Subscribe (key, idOrCallback, maybeCallback)
 Subscribes to a key to listen for changes with the first three arguments supplied, or can be used for sending/receiving fire events with the first two arguments supplied.
 
void SyncToPlayer (isoPlayer, namespace, key)
 Sends a specific key to a specific player.
 
void TeleportToLimbo (isoPlayer)
 
void UnregisterFrameworkHandler ()
 Unregister hook handlers for the framework.
 
void UnregisterGamemodeHandler (gamemode)
 Unregister hook handlers for the gamemode.
 
void UnregisterGenericHandler ()
 Unregister hook handlers for a plugin.
 
void UnregisterHandler (hookName, handler, object, functionName, category)
 Unregister a handler from a hook.
 
void UnregisterHandlers (objectOrHandlers, category)
 Unregister handlers for a specific category.
 
void UnregisterModuleHandler (module)
 Unregister hook handlers for a module.
 
void UnregisterPluginHandler (plugin)
 Unregister hook handlers for a plugin.
 
void Unsubscribe (key, id)
 Unsubscribes from a key. This will remove the callback from the channel.
 
void Watch (key, id, callback)
 Subscribes and fires callback immediately if the value is already set. Useful for UIs.
 

Data Fields

FrameworkZ Foundation Events
 

Detailed Description

Foundation for FrameworkZ.

Definition at line 85 of file __Foundation.lua.

Member Function Documentation

◆ AddAllHookHandlers()

void AddAllHookHandlers ( hookName )

Add a new hook handler to the list for all categories.

Parameters
hookNamestring The name of the hook handler to add.

◆ AddChannel()

void AddChannel ( key )

Add a new channel to the network system. Channels are used to subscribe to; changes in values, or fire events.

Parameters
keystring or table The key to use for the channel. Use a table to create nested channels.
See also
FrameworkZ.Foundation::Subscribe for an example on how to supply a table as a key.

◆ AddHookHandler()

void AddHookHandler ( hookName ,
category  )

Add a new hook handler to the list.

Parameters
hookNamestring The name of the hook handler to add.
categorystring The category of the hook (framework, module, plugin, generic).

◆ Broadcast()

void Broadcast ( namespace ,
key ,
remove  )

Broadcasts updated or removed data to all clients.

◆ CleanupConfirmations()

void CleanupConfirmations ( timeout )

Cleans up pending confirmations that have not been confirmed within a timeout period.

Parameters
timeout\number The timeout in seconds to clean up pending confirmations. Default: 300 seconds (5 minutes).

◆ ClearBatchSyncQueue()

void ClearBatchSyncQueue ( isoPlayer )

Clear the sync queue for a player.

References command(), isoPlayer(), module(), and OnConnected().

◆ EveryDays()

void EveryDays ( )

TODO move to shared timer hook.

◆ ExecuteAllHooks()

void ExecuteAllHooks ( hookName ,
... )

Execute all of the hooks.

Parameters
hookNamestring The name of the hook.
...\vararg Additional arguments to pass to the hook functions.

◆ ExecuteFrameworkHooks()

void ExecuteFrameworkHooks ( hookName ,
... )

Execute the framework hooks.

Parameters
hookNamestring The name of the hook.
...\vararg Additional arguments to pass to the hook functions.

◆ ExecuteGamemodeHooks()

void ExecuteGamemodeHooks ( hookName ,
... )

Execute the gamemode hooks.

Parameters
hookNamestring The name of the hook.
...\vararg Additional arguments to pass to the hook functions.

◆ ExecuteGenericHooks()

void ExecuteGenericHooks ( hookName ,
... )

Execute generic hooks.

Parameters
hookNamestring The name of the hook.
...\vararg Additional arguments to pass to the hook functions.

◆ ExecuteHook()

void ExecuteHook ( hookName ,
category ,
... )

Execute a given hook by its hook name for its given category.

Note
When a function is defined and registered as a hook, sometimes it's as an object. However in the definition it could be as some.func() or some:func() (notice the period and colon between the examples). If the function is defined as some:func() then the object is passed as the first argument. If the function is defined as some.func() then the object is not passed as the first argument, in which case we would also need to define some.func_PassOverHookableObject function which must return boolean true. This tells the hook system to not supply the object as the first argument if the function is apart of an object in the first place. Generic function hooks do not store an object and so do not have to worry about defining that additional property on its own function.
Parameters
hookNamestring The name of the hook.
categorystring The category of the hook (framework, module, plugin, generic).
...multiple Additional arguments to pass to the hook functions.

◆ ExecuteModuleHooks()

void ExecuteModuleHooks ( hookName ,
... )

Execute module hooks.

Parameters
hookNamestring The name of the hook.
...\vararg Additional arguments to pass to the hook functions.

◆ ExecutePluginHooks()

void ExecutePluginHooks ( hookName ,
... )

Execute plugin hooks.

Parameters
hookNamestring The name of the hook.
...\vararg Additional arguments to pass to the hook functions.

◆ Fire()

table Fire ( key ,
data ,
arguments  )

Fires a callback for a key. This will call the callback for the key with the value supplied.

Parameters
keystring The key to fire the callback for. Use a table to fire the callback for nested values.
See also
FrameworkZ.Foundation::Subscribe for an example on how to supply a table as a key.
Parameters
datatable The standard data to pass to the callback. Generally contains diagnostic information.
argumentstable The values to pass to the callback. This can be any type of values stored in the table.
Returns
table A table of return values from the callbacks. The keys are the IDs of the callbacks and the values are the return values from the callbacks.

◆ GetChannel()

table GetChannel ( key )

Get the channel for a key. This will return the channel data for the key.

Parameters
keystring or table The key to use for the channel. Use a table to create nested channels.
See also
FrameworkZ.Foundation::Subscribe for an example on how to supply a table as a key.
Returns
table The channel data for the key.

◆ GetChannelMeta()

table GetChannelMeta ( key )

Get the meta data for a channel. This will return the meta data for the key.

Parameters
keystring or table The key to use for the channel. Use a table to create nested channels.
See also
FrameworkZ.Foundation::Subscribe for an example on how to supply a table as a key.
Returns
table The meta data for the key.

◆ GetData()

any GetData ( isoPlayer ,
namespace ,
keys ,
subscriptionID ,
callback  )

Gets a value from a namespace by key(s).

Parameters
isoPlayerobject (Optional) The player to get the value for. This is only used on the client to send a request to the server.
namespacestring The namespace to get the value from.
keysstring or table The key(s) to get the value for. Supplying a table will do a lookup through all keys and get value at the last index.
subscriptionIDstring (Optional) A unique identifier for the subscription to be fired server-side after the value has been retrieved.
callbackfunction (Optional) A callback function to call after the value is retrieved. This is only used on the client to handle the response from the server.
Returns
any (except function) The value for the key in the namespace, or false if the namespace or key does not exist. Server-side only.
Note
If called on the client, the value may only be accessed in the callback immediately, or later after data has synchronized.

◆ GetLocalData()

void GetLocalData ( namespace ,
keys  )

◆ GetModule()

object GetModule ( moduleName )

Get a module by name.

Parameters
moduleNamestring The name of the module.
Returns
object The module object or \false if the module was not found.

◆ GetModuleMetaObject()

object GetModuleMetaObject ( moduleName )

Get a module's meta object stored on a module. Not every module will have a meta object. This is a very specific use case and is used for getting instantiable objects such as PLAYER objects or CHARACTER objects.

Parameters
moduleNamestring The name of the module.
Returns
object The meta object stored on the module or false if nothing was found.

◆ GetNamespace()

void GetNamespace ( namespace )

Retrieves the entire namespace table.

◆ GetNestedValue()

mixed GetNestedValue ( root ,
path  )

Get a nested value from a table using a path. This is used to get values from nested tables.

Parameters
roottable The root table to get the value from.
pathtable The path to the value. This is a table of keys to traverse the nested tables.
Returns
mixed The value at the end of the path, or nil if the path does not exist.
Note
Example path argument: {"key", "subkey"} == root["key"]["subkey"]

◆ GetSubscribers()

table GetSubscribers ( key )

Get the subscribers for a key. This will return the subscribers for the key.

Parameters
keystring The key to get the subscribers for. Use a table to get the subscribers for nested values.
See also
FrameworkZ.Foundation::Subscribe for an example on how to supply a table as a key.
Returns
table The subscribers for the key.

◆ GetVersion()

string GetVersion ( )

Get the version of FrameworkZ Foundation.

Returns
string The version of the FrameworkZ Foundation.

◆ HasChannel()

boolean HasChannel ( key )

Check if a channel exists for a key. This will return true if the channel exists, false otherwise.

Parameters
keystring or table The key to use for the channel. Use a table to create nested channels.
See also
FrameworkZ.Foundation::Subscribe for an example on how to supply a table as a key.
Returns
boolean True if the channel exists, false otherwise.

◆ HasSubscription()

boolean HasSubscription ( key ,
id  )

Check if a subscription exists for a key. This will return true if the subscription exists, false otherwise.

Parameters
keystring The key to check for. Use a table to check for nested values.
See also
FrameworkZ.Foundation::Subscribe for an example on how to supply a table as a key.
Parameters
idstring The ID of the function callback being checked.
Returns
boolean True if the subscription exists, false otherwise.

◆ Initialize()

void Initialize ( )

Initializes the framework foundation.

Note
The LoadGridSquare event is not added to the hook system for performance reasons, as it is called very frequently.

◆ InitializeClient()

void InitializeClient ( isoPlayer )

◆ InitializePlayer()

void InitializePlayer ( isoPlayer ,
playerData ,
charactersData  )

◆ LogChannels()

void LogChannels ( )

Log all channels and their subscribers to the console. This is useful for debugging and understanding the network system.

◆ New()

table New ( )

Create a new instance of the FrameworkZ framework.

Returns
table The new instance of the FrameworkZ framework.

◆ NewModule()

object NewModule ( moduleObject ,
moduleName  )

Create a new module for the FrameworkZ framework.

Parameters
moduleObjectobject The object to use as the module.
moduleNamestring The name of the module.
Returns
object The new module.

◆ OnClientCommand()

void OnClientCommand ( module ,
command ,
isoPlayer ,
arguments  )

Handles incoming commands from the client on the server.

Parameters
modulestring The name of the module that sent the command. This should match the NetworksName defined in FrameworkZ.Foundation.NetworksName.
commandstring The command that was sent by the client.
isoPlayerobject The player that sent the command. This is the player object that sent the command.
argumentstable The arguments that were sent with the command. This contains the data needed to process the command.
Note
This function is called on the server when a client sends a command to the server. It processes the command and sends a response back to the client using the networking system.

◆ OnGameStart()

void OnGameStart ( )

Called when the game starts. Executes the OnGameStart function for all modules.

◆ OnGetData()

void OnGetData ( data ,
namespace ,
keys ,
subscriptionID  )

◆ OnInitializePlayer()

void OnInitializePlayer ( data )

◆ OnRemoveData()

void OnRemoveData ( data )

Client receives key removal broadcast.

◆ OnSaveData() [1/2]

void OnSaveData ( data )

◆ OnSaveData() [2/2]

void OnSaveData ( data )

◆ OnSaveNamespace() [1/2]

void OnSaveNamespace ( data )

◆ OnSaveNamespace() [2/2]

void OnSaveNamespace ( data ,
namespace  )

◆ OnServerCommand()

void OnServerCommand ( module ,
command ,
arguments  )

Handles incoming commands from the server on the client.

Parameters
modulestring The name of the module that sent the command. This should match the NetworksName defined in FrameworkZ.Foundation.NetworksName.
commandstring The command that was sent by the server.
argumentstable The arguments that were sent with the command. This contains the data needed to process the command.
Note
This function is called on the client when the server sends a command to the client. It processes the command and sends a response back to the server using the networking system.

◆ OnServerStarted()

void OnServerStarted ( )

◆ OnSetData()

void OnSetData ( data ,
namespace ,
keys ,
value ,
subscriptionID ,
broadcast  )

◆ OnSync()

void OnSync ( data )

Server-side response to client sync request.

◆ OnSyncBroadcast()

void OnSyncBroadcast ( data )

Client receives sync data from broadcast.

◆ OnTeleportToLimbo()

void OnTeleportToLimbo ( data )

◆ PathToString()

string PathToString ( path )

Convert a path to a string. This is used to convert a table path to a string path.

Parameters
pathstring or table The path to convert. If a string is supplied, it will be returned as is. If a table is supplied, it will be concatenated with dots.
Returns
string The string representation of the path.

◆ PostInitializeClient()

void PostInitializeClient ( player )

◆ PreInitializeClient()

void PreInitializeClient ( isoPlayer )

◆ ProcessSaveableData()

void ProcessSaveableData ( object ,
ignoreList ,
encodeList  )

◆ QueueBatchSync()

void QueueBatchSync ( isoPlayer ,
namespace ,
key  )

Queue a key in a namespace for sync.

◆ RegisterFramework()

void RegisterFramework ( )

Register FrameworkZ. This is called after framework definition.

◆ RegisterFrameworkHandler()

void RegisterFrameworkHandler ( )

Register hook handlers for the framework.

Parameters
frameworktable The framework table containing the functions.

◆ RegisterGamemodeHandler()

void RegisterGamemodeHandler ( gamemode )

Register hook handlers for the gamemode.

Parameters
moduletable The module table containing the functions.

◆ RegisterGenericHandler()

void RegisterGenericHandler ( )

Register hook handlers for a plugin.

Parameters
plugintable The plugin table containing the functions.

◆ RegisterHandler()

void RegisterHandler ( hookName ,
handler ,
object ,
functionName ,
category  )

Register a handler for a hook.

Parameters
hookNamestring The name of the hook.
handlerfunction The function to call when the hook is executed.
objecttable (Optional) The object containing the function.
functionNamestring (Optional) The name of the function to call.
categorystring The category of the hook (framework, module, plugin, generic).

◆ RegisterHandlers()

void RegisterHandlers ( objectOrHandlers ,
category  )

Register handlers for a specific category.

Parameters
objecttable The object containing the functions.
categorystring The category of the hook (framework, module, plugin, generic).

◆ RegisterModule()

void RegisterModule ( module )

Register a module for FrameworkZ. This is called after module definition.

Parameters
moduleobject The module to register.

◆ RegisterModuleHandler()

void RegisterModuleHandler ( module )

Register hook handlers for a module.

Parameters
moduletable The module table containing the functions.

◆ RegisterNamespace()

void RegisterNamespace ( name )

Registers a storage namespace, e.g., "Players".

Parameters
namestring The name of the namespace to register.
Note
This must be used in the shared scope within an OnInitGlobalModData function.

◆ RegisterPluginHandler()

void RegisterPluginHandler ( plugin )

Register hook handlers for a plugin.

Parameters
plugintable The plugin table containing the functions.

◆ RemoveChannel()

void RemoveChannel ( key )

Remove a channel from the network system. This will remove all subscribers and meta data for the channel.

Parameters
keystring or table The key to use for the channel. Use a table to create nested channels.
See also
FrameworkZ.Foundation::Subscribe for an example on how to supply a table as a key.

◆ RemoveData()

void RemoveData ( namespace ,
key  )

Removes a key from a namespace and broadcasts removal.

◆ RemoveHookHandler()

void RemoveHookHandler ( hookName ,
category  )

Remove a hook handler from the list.

Parameters
hookNamestring The name of the hook handler to remove.
categorystring The category of the hook (framework, module, plugin, generic).

◆ RestoreData()

void RestoreData ( isoPlayer ,
command ,
namespace ,
keys ,
callback  )

◆ RestorePlayer()

void RestorePlayer ( isoPlayer ,
player ,
username ,
playerData ,
charactersData  )

◆ SaveData()

void SaveData ( isoPlayer )

◆ SaveNamespace()

void SaveNamespace ( isoPlayer ,
namespace  )

◆ SendFire()

string SendFire ( isoPlayer ,
subscriptionID ,
callback ,
... )

Sends a fire event to the server or client. This is used to send events to subscribers.

Parameters
isoPlayerobject The player sending the fire event. If nil, the event will be fired but no confirmation will be sent back (send and forget).
subscriptionIDstring The ID of the subscription to fire. This is the key used to subscribe to the event. It's recommended to use a string matching your function's callback name in a unique way when adding a subscription.
callbackfunction The callback to call when the server confirms the fire event. This is optional and can be nil if you don't need confirmation.
...multiple Additional arguments of any amount to pass to the subscription. These can be any type of values except functions as they do not get networked.
Returns
string The request ID for the fire event. This can be used to track the request and get confirmation later.

◆ SendGet()

void SendGet ( key ,
callback ,
callbackID ,
broadcast ,
... )

Sends a get request to the server.

Parameters
keymixed The key to get. Does not support getting functions.
callbackfunction The callback to call on the client when the server returns the value.
callbackIDstring The key to use for the callback on the server after getting the value.
broadcastboolean Whether to broadcast the get callback to all clients.

◆ SendSet()

void SendSet ( key ,
value ,
callback ,
callbackID ,
broadcast  )

Sends a set request to the server.

Parameters
keystring or table The key to set. Use a table to set nested values.
Note
Example key argument as a table: {"key", "subkey"} == _G["key"]["subkey"] or _G.key.subkey on lookup when setting.
Parameters
valuemixed The value to set. Does not support functions.
callbackfunction The callback to call on the client when the server confirms the set.
callbackIDstring The key to use for the callback on the server after setting the value.
broadcastboolean Whether to broadcast the set callback to all clients.

◆ ServerTick()

void ServerTick ( )

◆ SetData()

boolean SetData ( isoPlayer ,
namespace ,
keys ,
value ,
subscriptionID ,
broadcast ,
callback  )

Sets a value in a namespace and (optionally) broadcasts to all clients.

Parameters
isoPlayerobject (Optional when called server-side only) The player to set the value for. This is only used on the client to send a request to the server.
namespacestring The namespace to set the value in.
keysstring or table The key(s) to set the value for. Supplying a table will do a lookup through all keys and set value at the last index.
valueany (except function) The value to set.
subscriptionIDstring (Optional) A unique identifier for the subscription to be fired server-side after the value has been set.
broadcastboolean (Optional) Whether or not to broadcast the value to all clients.
callbackfunction (Optional) A callback function to call after the value is set. This is only used on the client to handle the response from the server.
Returns
boolean Whether or not the value was set successfully. Server-side only.
Note
If called on the client, the value may only be accessed in the callback immediately, or later after data has synchronized.

◆ SetLocalData()

void SetLocalData ( namespace ,
keys ,
value  )

◆ SetNestedValue()

mixed SetNestedValue ( root ,
path ,
value  )

Set a nested value in a table using a path. This is used to set values in nested tables.

Parameters
roottable The root table to set the value in.
pathtable The path to the value. This is a table of keys to traverse the nested tables.
valuemixed The value to set at the end of the path.
Returns
mixed The value that was set at the end of the path.
Note
Example path argument: {"key", "subkey"} == root["key"]["subkey"] = value

◆ StartBatchSync()

void StartBatchSync ( isoPlayer ,
interval ,
onComplete  )

Begin processing the queued keys for a player.

◆ StartServerTick()

void StartServerTick ( )

◆ Subscribe()

function Subscribe ( key ,
idOrCallback ,
maybeCallback  )

Subscribes to a key to listen for changes with the first three arguments supplied, or can be used for sending/receiving fire events with the first two arguments supplied.

Parameters
keystring The key to subscribe to. Use a table to subscribe to nested values.
Note
Example key argument as a table: {"key", "subkey"} == _G["key"]["subkey"] or _G.key.subkey on lookup when subscribing.
Parameters
idOrCallbackstring or function The ID of the function callback being added, or the callback function itself. If a string is supplied, it will be used as the ID for the callback.
maybeCallbackfunction The callback function to call when the key changes. This is optional if the first argument is a function.
Returns
function The callback function that was added. This can be used to unsubscribe later.

◆ SyncToPlayer()

void SyncToPlayer ( isoPlayer ,
namespace ,
key  )

Sends a specific key to a specific player.

◆ TeleportToLimbo()

void TeleportToLimbo ( isoPlayer )

◆ UnregisterFrameworkHandler()

void UnregisterFrameworkHandler ( )

Unregister hook handlers for the framework.

Parameters
frameworktable The framework table containing the functions.

◆ UnregisterGamemodeHandler()

void UnregisterGamemodeHandler ( gamemode )

Unregister hook handlers for the gamemode.

Parameters
moduletable The module table containing the functions.

◆ UnregisterGenericHandler()

void UnregisterGenericHandler ( )

Unregister hook handlers for a plugin.

Parameters
plugintable The plugin table containing the functions.

◆ UnregisterHandler()

void UnregisterHandler ( hookName ,
handler ,
object ,
functionName ,
category  )

Unregister a handler from a hook.

Parameters
hookNamestring The name of the hook.
handlerfunction The function to unregister.
objecttable (Optional) The object containing the function.
functionNamestring (Optional) The name of the function to unregister.
categorystring The category of the hook (framework, module, plugin, generic).

◆ UnregisterHandlers()

void UnregisterHandlers ( objectOrHandlers ,
category  )

Unregister handlers for a specific category.

Parameters
objecttable The object containing the functions.
categorystring The category of the hook (framework, module, plugin, generic).

◆ UnregisterModuleHandler()

void UnregisterModuleHandler ( module )

Unregister hook handlers for a module.

Parameters
moduletable The module table containing the functions.

◆ UnregisterPluginHandler()

void UnregisterPluginHandler ( plugin )

Unregister hook handlers for a plugin.

Parameters
plugintable The plugin table containing the functions.

◆ Unsubscribe()

void Unsubscribe ( key ,
id  )

Unsubscribes from a key. This will remove the callback from the channel.

Parameters
keystring The key to unsubscribe from. Use a table to unsubscribe from nested values.
See also
FrameworkZ.Foundation::Subscribe for an example on how to supply a table as a key.
Parameters
id\sting The ID of the function callback being removed. Default for fire events: "__default"

◆ Watch()

void Watch ( key ,
id ,
callback  )

Subscribes and fires callback immediately if the value is already set. Useful for UIs.

Parameters
keystring or table The key to watch. Use a table to watch nested values.
See also
FrameworkZ.Foundation::Subscribe for an example on how to supply a table as a key.
Parameters
idstring The ID of the function callback being added.
callbackfunction The callback to call when the key changes.

Field Documentation

◆ Events

Definition at line 87 of file __Foundation.lua.


The documentation for this class was generated from the following file: