You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This function will be performed when a value in a table changes.
Syntax
addChangeHandler(table,"value",function)
Example
functionbroadcastScore(self, newvalue)
outputChatBox("The Score is now "..tostring(newvalue))
endlocaltab= {}
addChangeHandler(tab, "score", broadcastScore)
tab.score=12-- "The Score is now 12"
But you can use it to set a value as read only too.
functionreadOnlyScore(self, newvalue)
-- The old value will be returned so the newvalue will be ignoredreturnself.scoreendlocaltab= {}
tab.score=12addChangeHandler(tab, "score", readOnlyScore)
tab.score=15print(tab.score) -- 12