Change Information Types
ChangeInfo
Enhanced type for change information in client listeners.
lua
export type ChangeInfo = {
action: "Set" | "SetValues" | "TableInsert" | "TableRemove",
path: {string},
index: number?,
}Action Types:
- "
Set": Single value change - "
SetValues": Multiple values changed "TableInsert": Item added to array"TableRemove": Item removed from array
Properties:
action: The type of change that occurredpath: Array of path segments that changedindex: Optional index for array operations
Example Usage:
lua
PlayerState.OnChanged(".", function(newValue, oldValue, info)
if info and info.action == "TableInsert" then
print(`Item added at index {info.index} to {table.concat(info.path, ".")}`)
end
end)ChangeCallback
Listener callback type shared by server and client change subscriptions.
- Server: OnChanged, OnSharedChanged
- Client: OnChanged, OnSharedChanged
The third argument is either:
- A path key array for simple sets — e.g.
{ "Coins" } - A
ChangeInfotable for table inserts/removes and nested updates
See the server and client listener pages for examples of each shape.
lua
export type ChangeCallback = (newValue: any, oldValue: any, changeInfo: ChangeInfo | {string}?) -> ()