
Lua之学习
文章平均质量分 66
无枝可依
这个作者很懒,什么都没留下…
展开
-
Lua之pcall和xpcall之学习
如果需要在Lua中处理错误,必须使用函数pcall(protected call)来包装需要执行的代码,pcall接收一个函数和要传递个后者的参数,并执行,执行结果:有错误、无错误;返回值true或者或false, errorinfo这里的33是给指定的function传的参数.如以下代码:if pcall(function(i) print("i am "..i) end, 33原创 2015-06-17 00:12:35 · 3441 阅读 · 0 评论 -
Lua之sethook学习
debug.sethook ([thread,] hook, mask [, count])Sets the given function as a hook.The string mask and the number count describewhen the hook will be called.The string mask may have the following cha原创 2015-06-17 00:27:39 · 11545 阅读 · 1 评论 -
Lua如何设置局部变量值进行调试
我们经常会需要知道一个函数的局部变量而进行调试。为此可以使用setupvalue设置并使用getupvalue获取这些局部变量、。一个简单的例子对本如下所示function newCounter () local n = 0 local k = 0 return function () k = n n = n + 1 return n endend转载 2015-06-16 23:51:03 · 2444 阅读 · 0 评论 -
Lua时间转换
转载: http://blog.youkuaiyun.com/kanelu/article/details/4678903#t1一、时间的三种格式1、用数值表示时间值 用数字值来表示时间值,实际上时间值的本质就是一个数字值。例如:d = 1131286477 这里的 1131286477 是一个以秒为单位的 格林威志时间(gmt),注意不同时区的时差2、转载 2015-06-15 12:55:07 · 2323 阅读 · 0 评论