KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
Sample code: function Account:new (o) o = o or {} -- create object if user does not provide one setmetatable(o, self) self.__index = self return o end taken from "Object-Oriented Programming: Classes" http://www.lua.org/pil/16.1.html What is the purpose of the self.__index = self line? And why is it executed every time an object is created?
Tags (comma-separated)
Save Edits
Cancel