Fix bad stack setup in collectgarbage().

This commit is contained in:
Mike Pall 2009-12-29 02:34:15 +01:00
parent 52f310bd3e
commit 241e8db3f1

View File

@ -354,14 +354,15 @@ LJLIB_CF(collectgarbage)
"\4stop\7restart\7collect\5count\1\377\4step\10setpause\12setstepmul"); "\4stop\7restart\7collect\5count\1\377\4step\10setpause\12setstepmul");
int32_t data = lj_lib_optint(L, 2, 0); int32_t data = lj_lib_optint(L, 2, 0);
if (opt == LUA_GCCOUNT) { if (opt == LUA_GCCOUNT) {
setnumV(L->top-1, cast_num((int32_t)G(L)->gc.total)/1024.0); setnumV(L->top, cast_num((int32_t)G(L)->gc.total)/1024.0);
} else { } else {
int res = lua_gc(L, opt, data); int res = lua_gc(L, opt, data);
if (opt == LUA_GCSTEP) if (opt == LUA_GCSTEP)
setboolV(L->top-1, res); setboolV(L->top, res);
else else
setintV(L->top-1, res); setintV(L->top, res);
} }
L->top++;
return 1; return 1;
} }