[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: Can't list all the non-local values with debug.getupvalue
- From: "Aaron Brown" <arundelo@...>
- Date: Mon, 23 Jul 2007 15:01:27 -0400
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
Your test program will print the names and values of TESTUP1
and TESTUP2 if, for instance, the test function includes
TESTUP1, TESTUP2 = TESTUP1, TESTUP2