Dear Lua List,
The Manual for Lua (pretty consistently across versions) says that you are not supposed to call lua_upvalueid for upvalues that do not exist:
>
Parameters
funcindex
and
n
are as in
the function
lua_getupvalue
,
but
n
cannot be greater than the number of upvalues
So... what happens if you do? Undefined behavior, essentially? I was semi-hoping to have a cheap way to check that there are at least N upvalues without pushing anything onto the stack, but lua_upvalueid's documentation does not make it clear that it would do something like return NULL reliably.
As the docs are written, I can't really rely on NULL getting passed back when I go too high. Is that intentional? Is NULL a valid upvalueid that can pop out of lua_upvalueid?
Sincerely,
Derp