
lua
文章平均质量分 77
拖拉机拖拉机
这个作者很懒,什么都没留下…
展开
-
lua实现sleep
解决方案1.在一个死循环中设置一个跳出条件,但是这样的做法会占用大量CPU资源代码:[xluren@test time_sleep]$ cat demo.lua local old_time=os.time()function demo() new_time=os.time() while true do if new_time - o原创 2014-12-07 15:39:52 · 3933 阅读 · 0 评论 -
lua pairs 和 ipairs 的差别
ipairs iterates over sequential integer keys,starting at 1 and breaking on the first nil pair.pairs iterates over all key-value pairs in the table. Note that this is not guaranteed to iterate in原创 2015-03-13 10:47:23 · 728 阅读 · 0 评论 -
理解lua 语言中的点、冒号与self
转载自:http://my.oschina.net/lonewolf/blog/173065&&转载自:http://www.faceye.net/search/80097.html在lua开发中我们经常会混淆这两者之间的区别,下面通过一个示例来解释:Class = {}Class.__index = Class function Class.new(x,y)转载 2015-03-12 14:38:03 · 4168 阅读 · 0 评论