lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


At 12:56 AM 1/28/2004, you wrote:
On Jan 27, 2004, at 10:48 PM, Ariel Manzur wrote:

It's a known bug.. the easiest workaround right now is to move any non-userdata (like a number or a string), or any private member to the beginning of the class.. As long as it's not exposed (or not userdata), it won't be able to break your object.. The fix will probably come in the next version; we're still considering options.

Alas, I can't really modify the class, without breaking a lot of things. I don't know what CVS comment I'd put in---"added unused dummy variable to make pet scripting project work" doesn't sound all that professional.

Is there any way I could write a "fake method" that would work? I've done similar things with SWIG, but I only see an option for inline Lua code in the tolua++ docs, not inline C or C++.

I'm not sure what you mean.. Maybe you can add a fake method that returns the object by value on the pkg, and use a macro to convert it to the field you want, like

#define get_field()     field

I'm not sure if you can put () on a macro like that though. There is also a way to turn a custon type (eg, a string) into a basic lua value.. You wouldn't have to recompile, it can be done using the -L option with tolua++; search for 'cppstring' on doit.lua and tolua++.h (sorry, it's not documented; I could go into more detail if you like).

bye..

Ariel.


Ariel.
http://Anime.com.ar
snm