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.
Frank Barknecht _ ______footils.org__