lua-users home
lua-l archive

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


At 12:43 AM 7/29/99 , you wrote:
>I've become real comfortable with upvalues as backwards references to
>overridden functions, but have stopped at about that point.   It seems
>then, if I'm on the right track now, that one of the neat "tricks" with
>upvalues is using a function to return a newly created function which uses
>upvalues - and since it's newly created, the upvalues are "current".  So
>each time you call the "creator" function it could return a different
>function based on the current value of the thing referenced by the upvalue.

If I'm understanding what you're describing here, I think you've just found
out about closures.

--
Michael T. Richter    <mtr@ottawa.com>    http://www.igs.net/~mtr/
          PGP Key: http://www.igs.net/~mtr/pgp-key.html
PGP Fingerprint: 40D1 33E0 F70B 6BB5 8353 4669 B4CC DD09 04ED 4FE8 
--
Michael T. Richter    <mtr@ottawa.com>    http://www.igs.net/~mtr/
          PGP Key: http://www.igs.net/~mtr/pgp-key.html
PGP Fingerprint: 40D1 33E0 F70B 6BB5 8353 4669 B4CC DD09 04ED 4FE8