lua-users home
lua-l archive

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


C++ methods, unless they are static methods, all have an invisible first
parameter.  You know this invisible first parameter as the "this" pointer.

Basically you won't be able to do what you want the way you want to do it.

----- Original Message -----
From: "Flavio Spolidoro Ferreira Gomes" <spol@tecgraf.puc-rio.br>
To: "Multiple recipients of list" <lua-l@tecgraf.puc-rio.br>
Sent: Friday, January 28, 2000 12:49 PM
Subject: Registering methods with lua_register


> Hi,
>
> I am trying to register a C++ object method to be called from the lua
enviroment
> but I am getting the following warning:
>
> ev_lua_engine.cpp: In method `LuaEngine::LuaEngine(char *)':
> ev_lua_engine.cpp:95: warning: converting from `void (LuaEngine::*)()' to
`void
> (*)(lua_State *)'
>
> Look at how I am doiing this:
>
> lua_register(LuaState, "ev_trap", this->EngineExec);
>
> This was the line 95.
>
> LuaState is a lua_State * variable which holds my enviromnet state (Iam
currently
>  using LuaNG);
>
> EngineExec is a method of my class LuaEngine.
>
> If I register a C pure  function everything works fine.
>
> Does anyone know the correct way to register a C++ method?
>
> Thanks in advance.
>
> Flavio Spolidoro.
>
>