[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Using callbacks functions in tolua
- From: Julien Hamaide <julien.hamaide@...>
- Date: Fri, 11 Aug 2006 16:25:10 +0200
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
In lua, a function is a variable.
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
Jose Marin wrote:
> Hi.
>
> I didn't find in the tolua documentation how to pass functions as
> parameters, and call them later. Like this:
>
> function anima(self) -- Do something with self...
>
> end
>
> local runner = CreateAnimation('runner.ani')
>
> runner:setCallback(anima)
>
>
> Then, the function anima will be called later, with a pointer to
> 'runner'.
>
>
>
> __________________________________________________ Fale com seus
> amigos de graça com o novo Yahoo! Messenger
> http://br.messenger.yahoo.com/
>
>
- --
- --
Julien Hamaide
Engineering Coach
10Tacle Studios Belgium / Elsewhere Entertainment
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.5 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iD8DBQFE3JNG/nbvGx8yYLARAqUVAKCW9oq2Z0yH+Uy76Czn9VDdOTcnEgCgmExy
3zlo7n/NPD/eNN2fA0yrl4Y=
=bJbg
-----END PGP SIGNATURE-----