| 90 | |
| 91 | |
| 92 | LUA_API int lua_checkstack (lua_State *L, int size) { |
| 93 | int res; |
| 94 | CallInfo *ci = L->ci; |
| 95 | lua_lock(L); |
| 96 | if (L->stack_last - L->top > size) /* stack large enough? */ |
| 97 | res = 1; /* yes; check is OK */ |
| 98 | else { /* no; need to grow stack */ |
| 99 | int inuse = cast_int(L->top - L->stack) + EXTRA_STACK; |
| 100 | if (inuse > LUAI_MAXSTACK - size) /* can grow without overflow? */ |
| 101 | res = 0; /* no */ |
| 102 | else /* try to grow stack */ |
| 103 | res = (luaD_rawrunprotected(L, &growstack, &size) == LUA_OK); |
| 104 | } |
| 105 | if (res && ci->top < L->top + size) |
| 106 | ci->top = L->top + size; /* adjust frame top */ |
| 107 | lua_unlock(L); |
| 108 | return res; |
| 109 | } |
| 110 | |
| 111 | |
| 112 | LUA_API void lua_xmove (lua_State *from, lua_State *to, int n) { |
no test coverage detected