
lua面向对象
jxnczyp
这个作者很懒,什么都没留下…
展开
-
lua面向对象----私有函数
local ShapeImp = {} function ShapeImp:calcArea() return self.w * self.h end Shape = {} function Shape:create() local shape = {x=10, y=20, w = 3, h = 4} setmetatable(shape, self) self.原创 2014-07-21 13:03:52 · 2267 阅读 · 3 评论 -
Lua面向对象----重载成员函数
最近做lua面向对象分享,如何实现Lua原创 2014-07-18 00:50:29 · 2768 阅读 · 0 评论 -
lua面向对象---调用基类函数
Shape = {} function Shape:create(x, y) local s = {} setmetatable(s, self) self.__index = self s:__init(x, y) return s end function Shape:__init(x,y) self.x = x self.y = y end function原创 2014-07-21 13:01:17 · 4246 阅读 · 0 评论