1. 点和冒号的区别是, 一个是方法调用, 一个面向对象,里面有个self , 修改了原function, 不会影响到复制对象。 local _M = {} function _M.one(a,b) return a + b end _M.one(1,2) # 结果是3 local w = _M ; w.one(1,2) # 结果是3 _M = nil w.one(1,2) # 报
专注分享技术,共同学习,共同进步。侵权联系[81616952@qq.com]
Copyright (C)ICode9.com, All Rights Reserved.
ICode9版权所有