Skip to content

KcdMp.on_state_change

A hook called on every change of any bag.

Set it to a function to hear every change: scope is "global", "player" or "entity"; id the pid or entity id (0 for the global bag); value the new string, nil when the key was removed. An error inside it is logged, never fatal.

KcdMp.on_state_change

function | nil - function(scope, id, key, value) end, or nil for no hook

KcdMp.on_state_change = function(scope, id, key, value)
System.LogAlways(string.format("[KcdMp] state %s %s %s = %s", scope, tostring(id), key, tostring(value)))
end

KcdMp.on_state · KcdMp.state · the State bags group of the index