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

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

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

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

I want to iterate throgh all of the values in the table used in the __index function of luabind created class objects. I went through the C++ source but I couldn't find the name of the table. Does anyone knnow what it is? I want to access it in a Lua file.

Thanks

------------------------------------------------------------------------------
Download Intel® 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
[hidden email]
https://lists.sourceforge.net/lists/listinfo/luabind-user
Reply | Threaded
Open this post in threaded view
|

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

Daniel Wallin
On Fri, Feb 19, 2010 at 02:26:12PM +0000, Colm Sloan wrote:
> I want to iterate throgh all of the values in the table used in the __index
> function of luabind created class objects. I went through the C++ source but
> I couldn't find the name of the table. Does anyone knnow what it is? I want
> to access it in a Lua file.

There is currently no way to access the underlying table. There is the
class_info() function that can be used to get information about the
class. See test/test_class_info.cpp.

There might be other ways to achieve what you want though. Why do you
need to iterate over the members?

--
Daniel Wallin
BoostPro Computing
http://www.boostpro.com

------------------------------------------------------------------------------
Download Intel® 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
[hidden email]
https://lists.sourceforge.net/lists/listinfo/luabind-user
Reply | Threaded
Open this post in threaded view
|

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

Colm Sloan
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
[hidden email]
https://lists.sourceforge.net/lists/listinfo/luabind-user