lua-users home
lua-l archive

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


Michael Bauroth wrote:
Hi,

I have implemented your solution, but had to change two lines because of a compiler error (VS2008). What do you mean?

was ...

#define LCB_ADD_SET(fieldname) { #fieldname , set_##fieldname }
#define LCB_ADD_GET(fieldname) { #fieldname , get_##fieldname }

changed to ...

#define LCB_ADD_SET(fieldname) { #fieldname , &set_##fieldname }
#define LCB_ADD_GET(fieldname) { #fieldname , &get_##fieldname }

Indeed, I meant to take the address of the function (get_foo, set_foo). It seems that with VC6 it was optional to use & in this case.


Just another question. What can I change to use the same solution as well for methods with more than one parameter, e.g. instead of btn:SetPosition( 1, 1 ) I want to use btn.Position = 1, 1?

I don't think this is possible since the __newindex and __index metamethods don't take multiple values. There was some discussion of the list some time ago about this.

What you might do instead is something like:
btn.Position = {1,1}

And deal with a table in your C++ implementation.


Regards,
Ignacio