Lines Matching defs:level

66 ** Create a new upvalue at the given level, and link it to the list of
69 static UpVal *newupval (lua_State *L, StkId level, UpVal **prev) {
73 uv->v.p = s2v(level); /* current value lives in the stack */
89 ** at the given level.
91 UpVal *luaF_findupval (lua_State *L, StkId level) {
95 while ((p = *pp) != NULL && uplevel(p) >= level) { /* search for it */
97 if (uplevel(p) == level) /* corresponding upvalue? */
102 return newupval(L, level, pp);
126 ** Check whether object at given level has a close metamethod and raise
129 static void checkclosemth (lua_State *L, StkId level) {
130 const TValue *tm = luaT_gettmbyobj(L, s2v(level), TM_CLOSE);
132 int idx = cast_int(level - L->ci->func.p); /* variable index */
144 ** the 'level' of the upvalue being closed, as everything after that
147 static void prepcallclosemth (lua_State *L, StkId level, int status, int yy) {
148 TValue *uv = s2v(level); /* value being closed */
152 else { /* 'luaD_seterrorobj' will set top to level + 2 */
153 errobj = s2v(level + 1); /* error object goes after 'uv' */
154 luaD_seterrorobj(L, status, level + 1); /* set error object */
172 void luaF_newtbcupval (lua_State *L, StkId level) {
173 lua_assert(level > L->tbclist.p);
174 if (l_isfalse(s2v(level)))
176 checkclosemth(L, level); /* value must have a close method */
177 while (cast_uint(level - L->tbclist.p) > MAXDELTA) {
181 level->tbclist.delta = cast(unsigned short, level - L->tbclist.p);
182 L->tbclist.p = level;
195 ** Close all upvalues up to the given stack level.
197 void luaF_closeupval (lua_State *L, StkId level) {
200 while ((uv = L->openupval) != NULL && (upl = uplevel(uv)) >= level) {
229 ** level. Return restored 'level'.
231 StkId luaF_close (lua_State *L, StkId level, int status, int yy) {
232 ptrdiff_t levelrel = savestack(L, level);
233 luaF_closeupval(L, level); /* first, close the upvalues */
234 while (L->tbclist.p >= level) { /* traverse tbc's down to that level */
238 level = restorestack(L, levelrel);
240 return level;