Re: What is the name of the table being checked in a Luabind object __index function?

Colm Sloan <[email protected]>
Newsgroups gmane.comp.lang.lua.bind.user
Message-ID <[email protected]>
Sorry for not replying. It didn't register as being replied for some reason.

I'll paste another question I asked:
I have an unusual situation. I have an object in C++ that is given many many
values in C++. I can grab this object and get its Lua equivalent:
// C++
m_LuaSelf = luabind::call_function<luabind::object>( L, "GetLuaSelf", this
);

-- Lua
function GetLuaSelf( cSelf )
return cSelf -- returns a lua object with all of the C++ data still in it
end

I want to make it so I can create a Lua object that inherits all of the
values associated with that C++ object. I made it so I pass the object to
another class but it can't use the syntactical sugar of ":", making it feel
very unnatural:

// C++
luabind::call_member<void>( m_LuaSelf, "Setup" );

-- Lua
function TheC++Class:Setup()
......... -- gets the other lua class name, which I'll class "MyTestClass"
 _G[ self.luaClassName ][ 'Setup' ]( self )
end

function MyTestClass:Setup()
-- it reaches this point

-- how can functions in this class be called using the ':' (colon) instead
'.' (period) e.g.
--self:bar() instead of
 --MyTestClass.bar( self ) -- the only way I've found
end





I have no idea if my approach is completely wrong. Apologies if it is :S Any
ideas on how I might go aout accessing the "self" functions of the derived
class using the ':'?

Thanks

------------------------------------------------------------------------------
Download Intel&#174; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev

_______________________________________________
luabind-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/luabind-user
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.