if I want to set the key to 0, i can't use reset(key, 0). I need to get a value, and then reset(key, value) ?
i am not understand why use dict:incr() not dict:set() in reset() method
function _M:reset(key, number)
if not number then
return nil, "expect a number at #2"
end
return self.dict:incr(key, -number, number)
end
if I want to set the key to 0, i can't use
reset(key, 0)
. I need to get a value, and thenreset(key, value)
? i am not understand why usedict:incr()
notdict:set()
in reset() method