Re: Help with OOP
Posted: Sun Dec 04, 2016 8:08 am
You might want to check that again, the example I wrote works fine. You might have a point with separating the "interface" as you call it so that an object doesn't have the new method, but as it stands the code works exactly as intended lol.Just a small note:
Code: Select all
item = {} item.__index = item function item:new(id) local item_object = setmetatable({}, item) return item_object end
Seems that "item.__index = item" doesn't do anything at all.