Re: Listing classes, properties and methods registered with luabind

Nigel Atkinson <[email protected]>
Newsgroups gmane.comp.lang.lua.bind.user
Message-ID <1267421585.1669.7.camel@ninja>
Here's what I do:

Add to uour C++ code:
#include <luabind/class_info.hpp>

and:
bind_class_info( L );

then in Lua:

function info( classInstance )
    local ci = class_info( classInstance )
    local str=''

    print( 'Name: '..ci.name )

    for k,v in pairs( ci.methods ) do
        str = str..' '..k
    end

    print( 'Methods:'..str )
    str=''

    for k,v in pairs( ci.attributes ) do
        str = str..' '..v
    end

    print( 'Attributes:'..str )
end

The trouble is that it works on instance's rather than the class, so you
have to know how to create one, to see how to use it.

Nigel

On Mon, 2010-03-01 at 15:52 +1100, Greg Santucci wrote:
> 
> At the lua repl, its possible to get a listing of all global symbols
> by issuing this command:
> 
> for k,v in pairs(_G) do print(k) end
> 
> I'd like to generate a listing of all the members of a class that have
> been registered with luabind in a similar way. How do I get to the lua
> table with this information?
> 
> Regards,
> Greg Santucci
> 
> ------------------------------------------------------------------------------
> 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



------------------------------------------------------------------------------
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
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.