On Aug 3, 2014, at 10:12 PM, Littlefield, Tyler <tyler@tysdomain.com> wrote:
Hello all:
I'm working on this project:
http://github.com/sorressean/aspen
and want to seriously revamp scripting. All of my game-objects are objects, so I'd like to wrap these in Lua and provide inheritance so that I just need to add methods and they can override etc. I have a few ideas and I'm hoping people can help with some solutions:
1) I'd love to have garbage collection actually free up the object.
2) Inheritance: I never deal with multiple inheritance, so that's not an issue.
I'm having a really hard time writing this, however. Are there any examples that show how to pull this off the right way? I'd ultimately be happy with two classes, one of which inherits the other so I can see how best to do that in the API.
I'd greatly appreciate any information/help. TIA,
A few implementations of class based OO:
http://lua-users.org/wiki/InheritanceTutorial
For a prototype based object system (See LDocs at top of file):
https://github.com/lua-stdlib/lua-stdlib/blob/master/lib/std/object.lua
Or simple table object cloning:
https://github.com/lua-stdlib/lua-stdlib/blob/master/lib/std/table.lua#L79