Skip to content

API > SyncVar > OnVariableSet


SyncVar.OnVariableSet⚓︎

Name Type
OnVariableSet EventHandler

Event callback function requirement⚓︎

Info

This property is an event. It means that you need to add a listener function to it. Here how that function needs to look like.

function(any value);

Parameters⚓︎
Name Type Description
value any The value set to the variable.

Usage⚓︎

--- @type 
local syncvar;

--- callback function called when event triggers
--- @param any any
local function CallBack(any)
    -- code to handle event call back
end


-- Regsiter callback function
syncvar.OnVariableSet.Add(CallBack);

Description⚓︎

Event handler called when the Sync variable set (even if still the same values set).