|
Rodrigo Araújo wrote:
Hi there,
[...]
This code inside the class gives the following error: In member function 'int Classe::B(lua_State*)':317: error: argument of type 'int (Classe::)(lua_State*)' does not match 'int (*)(lua_State*)'In member function 'int Classe::A(lua_State*)':327: error: argument of type 'int (Classe::)(lua_State*)' does not match 'int (*)(lua_State*)'Lines 317 and 327 are the lines in which I call lua_pushcfunction. So, how should I do it? Is it possible to do this?
Seems that your 'drawer' function is a member of your class. If so, you cannot use pushcfunction because it only allows non-member functions (or static ones) to be pushed.
You can take a look at Lunar itself. When it registers in Lua your class functions, it actually registers a function called 'thunk', which retrieves the member function to be called using upvalues.