Nested luabind classes declared in Lua

Posted by Matt Fichman on Stack Overflow See other posts from Stack Overflow or by Matt Fichman
Published on 2010-05-23T04:32:10Z Indexed on 2010/05/23 4:40 UTC
Read the original article Hit count: 304

Filed under:
|
|
|

I am trying to declare a class B in a namespace A using Luabind (from the Lua side). I figure that if Luabind has a clean way to do this, it would look something like this:

class 'A.B' (Super)

function A.B:__init()
    Super.__init(self)
end

Notice that the B class is defined in the A table. I know the following hackish way of doing this:

class 'A.B' (Super)
A = {}
A.B = _G['A.B']

However, I would really like to know if Luabind provides this feature explicitly.

© Stack Overflow or respective owner

Related posts about classes

Related posts about lua