I have a problem with extending classes in renoise lua. This may relate to luabind, but I tried their docs with little help and their IRC channel with no replies.
What I want to do is have a class serve as a table at the same time. Basically I want to extend the table class of lua so I could do something like:
local tableClass = myTableClass() table.insert(tableClass, "a") tableClass:myMethod() print(tableClass)
To make this possible there could be a number of approaches. In the LUA Manual I found the .__index “metamethod” of tables that can provide inheritance, but it doesn’t seem to work for the renoise class structure. It is omitted in the renoise documentation as well as the luabind one.
LUA __index doc: http://www.lua.org/pil/13.4.1.html
Am I misunderstanding something about __index. Should it not be available for luabind classes too?
Another idea was trying to inhert the table as you would other luabind classes. But it doesn’t seem very lua-like to me (and doesn’t work):
class "myTableClass" (table) or local abstractTable = table.create() class "myTableClass" (abstractTable)
Any thoughts on this, maybe I should avoid the luabind class structure completely?