diff options
-rw-r--r-- | lapi.c | 6 | ||||
-rw-r--r-- | lbaselib.c | 7 | ||||
-rw-r--r-- | lua.h | 3 |
3 files changed, 11 insertions, 5 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lapi.c,v 2.117 2010/03/26 20:58:11 roberto Exp roberto $ | 2 | ** $Id: lapi.c,v 2.118 2010/03/29 17:43:14 roberto Exp roberto $ |
3 | ** Lua API | 3 | ** Lua API |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -952,6 +952,10 @@ LUA_API int lua_gc (lua_State *L, int what, int data) { | |||
952 | g->gckind = KGC_GEN; | 952 | g->gckind = KGC_GEN; |
953 | break; | 953 | break; |
954 | } | 954 | } |
955 | case LUA_GCINC: { /* change collector to incremental mode */ | ||
956 | g->gckind = KGC_NORMAL; | ||
957 | break; | ||
958 | } | ||
955 | default: res = -1; /* invalid option */ | 959 | default: res = -1; /* invalid option */ |
956 | } | 960 | } |
957 | lua_unlock(L); | 961 | lua_unlock(L); |
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lbaselib.c,v 1.239 2010/03/22 18:28:03 roberto Exp roberto $ | 2 | ** $Id: lbaselib.c,v 1.240 2010/03/26 20:58:11 roberto Exp roberto $ |
3 | ** Basic library | 3 | ** Basic library |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -148,10 +148,11 @@ static int luaB_gcinfo (lua_State *L) { | |||
148 | 148 | ||
149 | static int luaB_collectgarbage (lua_State *L) { | 149 | static int luaB_collectgarbage (lua_State *L) { |
150 | static const char *const opts[] = {"stop", "restart", "collect", | 150 | static const char *const opts[] = {"stop", "restart", "collect", |
151 | "count", "step", "setpause", "setstepmul", "isrunning", "gen", NULL}; | 151 | "count", "step", "setpause", "setstepmul", "isrunning", |
152 | "gen", "inc", NULL}; | ||
152 | static const int optsnum[] = {LUA_GCSTOP, LUA_GCRESTART, LUA_GCCOLLECT, | 153 | static const int optsnum[] = {LUA_GCSTOP, LUA_GCRESTART, LUA_GCCOLLECT, |
153 | LUA_GCCOUNT, LUA_GCSTEP, LUA_GCSETPAUSE, LUA_GCSETSTEPMUL, | 154 | LUA_GCCOUNT, LUA_GCSTEP, LUA_GCSETPAUSE, LUA_GCSETSTEPMUL, |
154 | LUA_GCISRUNNING, LUA_GCGEN}; | 155 | LUA_GCISRUNNING, LUA_GCGEN, LUA_GCINC}; |
155 | int o = optsnum[luaL_checkoption(L, 1, "collect", opts)]; | 156 | int o = optsnum[luaL_checkoption(L, 1, "collect", opts)]; |
156 | int ex = luaL_optint(L, 2, 0); | 157 | int ex = luaL_optint(L, 2, 0); |
157 | int res = lua_gc(L, o, ex); | 158 | int res = lua_gc(L, o, ex); |
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lua.h,v 1.264 2010/03/22 18:28:03 roberto Exp roberto $ | 2 | ** $Id: lua.h,v 1.265 2010/03/26 20:58:11 roberto Exp roberto $ |
3 | ** Lua - A Scripting Language | 3 | ** Lua - A Scripting Language |
4 | ** Lua.org, PUC-Rio, Brazil (http://www.lua.org) | 4 | ** Lua.org, PUC-Rio, Brazil (http://www.lua.org) |
5 | ** See Copyright Notice at the end of this file | 5 | ** See Copyright Notice at the end of this file |
@@ -267,6 +267,7 @@ LUA_API int (lua_status) (lua_State *L); | |||
267 | #define LUA_GCSETSTEPMUL 7 | 267 | #define LUA_GCSETSTEPMUL 7 |
268 | #define LUA_GCISRUNNING 8 | 268 | #define LUA_GCISRUNNING 8 |
269 | #define LUA_GCGEN 9 | 269 | #define LUA_GCGEN 9 |
270 | #define LUA_GCINC 10 | ||
270 | 271 | ||
271 | LUA_API int (lua_gc) (lua_State *L, int what, int data); | 272 | LUA_API int (lua_gc) (lua_State *L, int what, int data); |
272 | 273 | ||