small optimizations

This commit is contained in:
Roberto Ierusalimschy
2001-12-20 19:26:52 -02:00
parent 18afb90349
commit 42754c0f15
4 changed files with 18 additions and 29 deletions

4
lapi.c
View File

@@ -104,7 +104,9 @@ LUA_API void lua_settop (lua_State *L, int index) {
lua_lock(L);
if (index >= 0) {
api_check(L, index <= L->stack_last - L->ci->base);
luaD_adjusttop(L, L->ci->base+index);
while (L->top < L->ci->base + index)
setnilvalue(L->top++);
L->top = L->ci->base + index;
}
else {
api_check(L, -(index+1) <= (L->top - L->ci->base));