lua-users home
lua-l archive

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


I've tried that, but the compiler can't find the definition for
"lua_Object"!


> you have to write the method with the following prototype:
>   void SetCallback (lua_Object f);
> 
> (tolua understands lua_Object as a valid and known type)
> 
> to store the object in C++, you can use lua_ref (or the lua 
registry table).
> the lua function is then called using the convetional Lua API.
> 
> -- waldemar
> 
> At 13:34 6/2/2003 +0000, you wrote:
> 
> >Hi!
> >
> >Consider the following cleaned class, in sample.pkg:
> >
> >
> >
> >class Sample{
> >   Sample();
> >   ~Sample();
> >
> >   void SetCallback( t_function f );// what type is correct to get 
a
> >Lua function pointer?
> >}
> >
> >In Lua, I would like to do this:
> >
> >function test()
> >...
> >end
> >
> >
> >sample = Sample:new()
> >
> >sample:SetCallback(test)
> >
> >That's the point! In C++, what type is "t_function"?
> >And how to store the address of the parameter (a function) in C++, 
to
> >call it later?
> >
> >I know how to do all this in pure Lua, but using tolua (a great 
tool)
> >I don't know how!!!