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.
Help with OOP
Forum rules
Before you make a thread asking for help, read this.
Before you make a thread asking for help, read this.
- Sir_Silver
- Party member
- Posts: 286
- Joined: Mon Aug 22, 2016 2:25 pm
- Contact:
Re: Help with OOP
Re: Help with OOP
It's the same thing, a table with a property __index with value item, so yes it's the same in both cases.
Who is online
Users browsing this forum: Google [Bot], Semrush [Bot] and 3 guests