|
Hi.I'm writing some 5.1-based modules that uses lua_getupvalue and lua_setupvalue. By default, when building in release mode, the platform I'm targeting strips debug info, and the code in question breaks.Looking into the Lua source suggested that the `if (name)` branch in those two functions is being skipped; basically, sizeupvalues is turning up 0 on me and aux_upvalue early-outs. (I see that in 5.2 and 5.3 aux_upvalue takes more pains to return a string, but it seems this must be accounting for a different scenario?)With the following change to the Lua closure partProto *p = f->l.p;const char * str;if (!(1 <= n && n <= f->l.nupvalues)) return NULL;*val = f->l.upvals[n-1]->v;str = p->sizeupvalues ? getstr(p->upvalues[n-1]) : NULL;return (str == NULL) ? str : "(*no name)";I seem to be reliably getting upvalues again. However, I'd be interested to know if I'm violating any other assumptions.