[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: RE: Can't list all the non-local values with debug.getupvalue
- From: "Tim Hunter" <Tim.Hunter@...>
- Date: Mon, 23 Jul 2007 15:56:36 -0400
Of course! Thanks!
> -----Original Message-----
> From: firstname.lastname@example.org
> [mailto:email@example.com] On Behalf Of Aaron Brown
> Sent: Monday, July 23, 2007 3:01 PM
> To: Lua list
> Subject: Re: Can't list all the non-local values with debug.getupvalue
> Tim Hunter wrote:
> > The program works the way I expect it to, except that it
> does not list
> > the values of TESTUP1 and TESTUP2.
> This is because the function test doesn't "close over"
> TESTUP1 and TESTUP2. For a variable to be an upvalue to a
> function, it has to be used somewhere in that function
> # A local variable used by an inner function is called an #
> upvalue, or external local variable, inside the inner # function.
> Your test program will print the names and values of TESTUP1
> and TESTUP2 if, for instance, the test function includes
> something like
> TESTUP1, TESTUP2 = TESTUP1, TESTUP2