Murga-Projects Forums
my_widget.bind_lua_typeinfo.name - Printable Version

+- Murga-Projects Forums (http://www.murga-projects.com/forum)
+-- Forum: Project Forums (/forumdisplay.php?fid=1)
+--- Forum: MurgaLua - General (/forumdisplay.php?fid=2)
+--- Thread: my_widget.bind_lua_typeinfo.name (/showthread.php?tid=208)


my_widget.bind_lua_typeinfo.name - mikshaw - 09-15-2007 04:31 AM

Inside the table of each widget class there is a table called bind_lua_typeinfo. That table contains the key "name" whose value is the widget class.
In other words:

Code:
my_button=fltk:Fl_Button(x,y,w,h)
print(my_button.bind_lua_typeinfo.name)

This prints "Fl_Button", which might be a useful piece of information in some cases, for example if a particular function needed to be called depending on what type of widget was activated.

I wonder if bind_lua_typeinfo is an intentionally created table, or if it's merely a product of whatever was used to create the FLTK bindings (tolua?). I ask this because if I ever find this info truly useful myself, it would be rather bothersome if suddenly a murgaLua version was released that no longer held the info (it doesn't appear to be available elsewhere). It seems like it might be a byproduct of the binding, which might mean that it would be much easier for something like this to slip through the cracks than something that was puposefully included.


RE: my_widget.bind_lua_typeinfo.name - JohnMurga - 09-15-2007 07:20 AM

The bindings are not created with to "tolua", however a lot of them are generated with heavily hacked scripts that I knocked up over a long weekend I was playing with srtti ... There is also a fair amount of "hand crafting", which is a pain in arse.

Either way you CAN count on the bind_lua_typeinfo being set for all the FLTK stuff, now and into the future ... In any case it may be expanded for some widgets.

Cheers
JohnM


RE: my_widget.bind_lua_typeinfo.name - mikshaw - 09-15-2007 07:40 AM

=o)

Thanks.