lua-users home
lua-l archive

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


> In lua, a function is a variable.

You are right, Julien, but the 'anima' function will
be called in C++ code;

The 'setCallback' is a method of the Animation class.

My doubt is how to declare the method 'setCallback' in
tolua, and how to store in the C++ code the reference
to the Lua funcion and how to call it later, passing
the 'runner' object.




> 
> when you write
> 
> function anima(self)
> - -- Do something with self...
> 
> end
> 
> you actually writing
> 
> anima = function( self )
> 
> - -- Do something with self...
> 
> end
> 
> so in your callback, just do
> 
> runner:setCallback(anima)
> 
>      self.somefield = anima;
> end
> 
> runner:Callback()
>    self.somefield( self );
> end
> 
> Julien
> 
> 


		
_______________________________________________________ 
Novidade no Yahoo! Mail: receba alertas de novas mensagens no seu celular. Registre seu aparelho agora! 
http://br.mobile.yahoo.com/mailalertas/