摘要:
function newCounter() local i = 0 return function() i = i + 1 return i end end c1 = newCounter() c2 = newCounter() print(c1()) print(c1()) print(c1()) print(c1()) pri... 阅读全文
摘要:
-- create class Account = {balance = 0} -- construct function Account:new(o) o = o or {} setmetatable(o,self) self.__index = self return o end function Account:deposit(v) ... 阅读全文