[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: upvalue indices
- From: Roberto Ierusalimschy <roberto@...>
- Date: Wed, 29 Jan 2003 08:53:06 +0000
> I only have 1 upvalue in this case (though at times I might have 2); I had
> assumed this would return NULL, but it doesn't seem to do so reliably.
This is not reliable at all; it is not even implemented ;-) Lua assumes
that you know how many upvalues you have before accessing them.
You can use the debug API to know the number of upvalues of a function
(although we do not recomend the use of debug facilities in "normal"
code), or else use Daniel Remar's sugestion.