[PD] Clocks and [pipe] in Lua

Frank Barknecht fbar at footils.org
Fri Mar 14 12:01:41 CET 2008


Hallo,
Frank Barknecht hat gesagt: // Frank Barknecht wrote:

> Basically closures are functions that you define inside of other
> functions. Local variables that are defined in the outer function are
> accessible in the inner function, the closure, as well, even after the
> outer function returns. 

I maybe should point out, that the inner function, the closure, has to stay
accessible after the outer function returns. This can be achieved in
Lua by for example returning the closure itself or by storing it in a
variable or table field that is still accessible after the outer
function has ended, which in Lua is possible because functions are values. "lpipe" stores  it in the "self"-table.

Ciao
-- 
 Frank Barknecht                                     _ ______footils.org__




More information about the Pd-list mailing list