摘要:
Account={balance=0}function Account.withdraw(self,v) self.balance=self.balance-venda={balance=0,withdraw=Account.withdraw}a.withdraw(a,260)--面向对象语言... 阅读全文
摘要:
father = { house=1}son = { car=1}setmetatable(son, father) --把son的metatable设置为fatherprint(son.house)输出的结果是nil,但如果把代码改为father = { house=1}fath... 阅读全文
摘要:
1.习惯上,Lua的下表从1开始,只有这样,才可以使用标准库的函数--链表list=nillist={next=list,value="v"}list={next=list,value=88}local l=listwhile l do print(l.value) l=l.nexten... 阅读全文