标签:lua
lua 里面的面向对象可以使开发看起来更简洁
local tmp = {};
function tmp:create(id)
local obj = {
m_id = id,
m_name = "guoyilong ",
};
setmetatable(obj, {__index = tmp});
return obj;
end
function tmp:printout()
self.m_id = self.m_id * 45;
print("===========> self.m_id ",self.m_id);
end
local tt = tmp:create(45);
print("=====> ",tt.m_id);
tt:printout();
obj 作为类tmp 的属性
标签:lua
原文地址:http://blog.csdn.net/guoyilongedu/article/details/37818701