diff options
-rw-r--r-- | lstate.c | 4 | ||||
-rw-r--r-- | ltests.c | 6 | ||||
-rw-r--r-- | lua.c | 4 | ||||
-rw-r--r-- | lua.h | 6 |
4 files changed, 11 insertions, 9 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lstate.c,v 1.58 2001/03/02 17:27:50 roberto Exp roberto $ | 2 | ** $Id: lstate.c,v 1.59 2001/03/07 18:09:25 roberto Exp roberto $ |
3 | ** Global State | 3 | ** Global State |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -90,7 +90,7 @@ static void f_luaopen (lua_State *L, void *ud) { | |||
90 | } | 90 | } |
91 | 91 | ||
92 | 92 | ||
93 | LUA_API lua_State *lua_open (lua_State *OL, int stacksize) { | 93 | LUA_API lua_State *lua_newthread (lua_State *OL, int stacksize) { |
94 | struct Sopen so; | 94 | struct Sopen so; |
95 | lua_State *L; | 95 | lua_State *L; |
96 | if (OL) lua_lock(OL); | 96 | if (OL) lua_lock(OL); |
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: ltests.c,v 1.74 2001/03/06 20:09:38 roberto Exp roberto $ | 2 | ** $Id: ltests.c,v 1.75 2001/03/07 13:22:55 roberto Exp roberto $ |
3 | ** Internal Module for Debugging of the Lua Implementation | 3 | ** Internal Module for Debugging of the Lua Implementation |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -422,7 +422,7 @@ static int newtag (lua_State *L) { | |||
422 | } | 422 | } |
423 | 423 | ||
424 | static int doonnewstack (lua_State *L) { | 424 | static int doonnewstack (lua_State *L) { |
425 | lua_State *L1 = lua_open(L, luaL_check_int(L, 1)); | 425 | lua_State *L1 = lua_newthread(L, luaL_check_int(L, 1)); |
426 | if (L1 == NULL) return 0; | 426 | if (L1 == NULL) return 0; |
427 | *((int **)L1) = &islocked; /* initialize the lock */ | 427 | *((int **)L1) = &islocked; /* initialize the lock */ |
428 | lua_dostring(L1, luaL_check_string(L, 2)); | 428 | lua_dostring(L1, luaL_check_string(L, 2)); |
@@ -445,7 +445,7 @@ static int d2s (lua_State *L) { | |||
445 | 445 | ||
446 | 446 | ||
447 | static int newstate (lua_State *L) { | 447 | static int newstate (lua_State *L) { |
448 | lua_State *L1 = lua_open(NULL, luaL_check_int(L, 1)); | 448 | lua_State *L1 = lua_open(luaL_check_int(L, 1)); |
449 | if (L1) { | 449 | if (L1) { |
450 | *((int **)L1) = &islocked; /* initialize the lock */ | 450 | *((int **)L1) = &islocked; /* initialize the lock */ |
451 | lua_pushnumber(L, (unsigned long)L1); | 451 | lua_pushnumber(L, (unsigned long)L1); |
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lua.c,v 1.63 2001/02/23 17:28:12 roberto Exp roberto $ | 2 | ** $Id: lua.c,v 1.64 2001/02/23 20:28:26 roberto Exp roberto $ |
3 | ** Lua stand-alone interpreter | 3 | ** Lua stand-alone interpreter |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -327,7 +327,7 @@ int main (int argc, l_char *argv[]) { | |||
327 | int status; | 327 | int status; |
328 | opt.toclose = 0; | 328 | opt.toclose = 0; |
329 | getstacksize(argc, argv, &opt); /* handle option `-s' */ | 329 | getstacksize(argc, argv, &opt); /* handle option `-s' */ |
330 | L = lua_open(NULL, opt.stacksize); /* create state */ | 330 | L = lua_open(opt.stacksize); /* create state */ |
331 | LUA_USERINIT(L); /* open libraries */ | 331 | LUA_USERINIT(L); /* open libraries */ |
332 | register_getargs(argv); /* create `getargs' function */ | 332 | register_getargs(argv); /* create `getargs' function */ |
333 | status = handle_argv(argv+1, &opt); | 333 | status = handle_argv(argv+1, &opt); |
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lua.h,v 1.89 2001/02/23 17:17:25 roberto Exp roberto $ | 2 | ** $Id: lua.h,v 1.90 2001/02/23 17:28:12 roberto Exp roberto $ |
3 | ** Lua - An Extensible Extension Language | 3 | ** Lua - An Extensible Extension Language |
4 | ** TeCGraf: Grupo de Tecnologia em Computacao Grafica, PUC-Rio, Brazil | 4 | ** TeCGraf: Grupo de Tecnologia em Computacao Grafica, PUC-Rio, Brazil |
5 | ** e-mail: lua@tecgraf.puc-rio.br | 5 | ** e-mail: lua@tecgraf.puc-rio.br |
@@ -93,7 +93,7 @@ typedef char l_char; | |||
93 | /* | 93 | /* |
94 | ** state manipulation | 94 | ** state manipulation |
95 | */ | 95 | */ |
96 | LUA_API lua_State *lua_open (lua_State *L, int stacksize); | 96 | LUA_API lua_State *lua_newthread (lua_State *L, int stacksize); |
97 | LUA_API void lua_close (lua_State *L); | 97 | LUA_API void lua_close (lua_State *L); |
98 | 98 | ||
99 | 99 | ||
@@ -210,6 +210,8 @@ LUA_API void *lua_newuserdata (lua_State *L, size_t size); | |||
210 | ** =============================================================== | 210 | ** =============================================================== |
211 | */ | 211 | */ |
212 | 212 | ||
213 | #define lua_open(n) lua_newthread(NULL, (n)) | ||
214 | |||
213 | #define lua_pop(L,n) lua_settop(L, -(n)-1) | 215 | #define lua_pop(L,n) lua_settop(L, -(n)-1) |
214 | 216 | ||
215 | #define lua_register(L,n,f) (lua_pushcfunction(L, f), lua_setglobal(L, n)) | 217 | #define lua_register(L,n,f) (lua_pushcfunction(L, f), lua_setglobal(L, n)) |