摘要: function createCountdownTimer(second) local ms = second * 1000 local function countDown() ms = ms - 1 return ms end return countDownendtimer... 阅读全文
posted @ 2015-11-02 11:54 吴筱军 阅读(986) 评论(0) 推荐(0) 编辑
摘要: function foo() print(g or "'g' is not defined!")endfoo()env = { g = 100, print = print }setfenv(foo, env) --设置foo的环境为表envfoo()print(g or "'g' is not d... 阅读全文
posted @ 2015-11-02 11:49 吴筱军 阅读(2226) 评论(0) 推荐(0) 编辑
摘要: 迭代function enum(array) local index = 1 return function() --返回迭代函数 local ret = array[index] index = index + 1 return ret endendfunction foreach(array, ... 阅读全文
posted @ 2015-11-02 11:29 吴筱军 阅读(347) 评论(0) 推荐(0) 编辑