• On change?
    2 replies, posted
Is there somehow to determine if a value changes? Something like this: if Time == 1 then add = add + 1 elseif Time == 2 then add = add + 1 ... etc etc
[lua]local lastvalue; local function doSomethingIfItsChanged(value) if (value ~= lastvalue) then lastvalue = value; -- do something end end doSomethingIfItsChanged(5) -- does something doSomethingIfItsChanged(5) -- doesnt' doSomethingIfItsChanged(6) -- does doSomethingIfItsChanged(5) -- does doSomethingIfItsChanged(5) -- doesn't[/lua]
Thanks
Sorry, you need to Log In to post a reply to this thread.