:和 . 区别
.
stu={id=100,name="Tom",age=21}--成员变量
function stu.toString()--成员函数
return stu.id .. stu.name .. stu.age
end
print(stu.toString())
print(stu:toString())
:
stu={id=100,name="Tom",age=21}
function stu:toString()
return self.id .. self.name .. self.age
end
print(stu:toString())