| 168 | |
| 169 | |
| 170 | LUA_API void lua_settop (lua_State *L, int idx) { |
| 171 | StkId func = L->ci->func; |
| 172 | lua_lock(L); |
| 173 | if (idx >= 0) { |
| 174 | api_check(L, idx <= L->stack_last - (func + 1), "new top too large"); |
| 175 | while (L->top < (func + 1) + idx) |
| 176 | setnilvalue(L->top++); |
| 177 | L->top = (func + 1) + idx; |
| 178 | } |
| 179 | else { |
| 180 | api_check(L, -(idx+1) <= (L->top - (func + 1)), "invalid new top"); |
| 181 | L->top += idx+1; /* 'subtract' index (index is negative) */ |
| 182 | } |
| 183 | lua_unlock(L); |
| 184 | } |
| 185 | |
| 186 | |
| 187 | /* |
no outgoing calls
no test coverage detected