摘要:
# 在table的基础山增加了更直观的列表操作函数,同时使用了_count来跟踪元素数量 local list = {} list.__cname = "util.list" local null = {} list.null = null list.__newindex = function(se 阅读全文
摘要:
把table当做函数一样调用时触发 local obj = {} local mt = { __call = function(tb, target) print("__call") end } setmetatable(obj, mt) obj(1) # 可以实现ClassName()直接触发对象 阅读全文
摘要:
# for in遍历, 跟在in后面是3个参数:iteratorFunc, iteratorObj, initArg 第1次时,会用iteratorObj和initArg调用iteratorFunc, iteratorFunc(iteratorObj, initArg) 第2次时,会用iterato 阅读全文
摘要:
类似其他语言下的try, catch: pcall(func, arg1, ...) 相当于捕获了不做任何处理 1 try { 2 //do something 3 } catch (Exception ex) { 4 // do nothing 5 } xpcall(func, exception 阅读全文
摘要:
ubuntu下一个用来管理开机自启动服务的程序,今天在ss vps上安装时老是提示这个错误,百度后,下面的这个方法可行: vi /etc/apt/source.list 输入i,进入Insert模式 在最后加入 deb http://archive.ubuntu.com/ubuntu/ trusty 阅读全文