diff options
Diffstat (limited to 'lbaselib.c')
| -rw-r--r-- | lbaselib.c | 11 |
1 files changed, 6 insertions, 5 deletions
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: lbaselib.c,v 1.62 2002/03/27 15:30:41 roberto Exp roberto $ | 2 | ** $Id: lbaselib.c,v 1.63 2002/04/02 20:42:20 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 | */ |
| @@ -206,7 +206,7 @@ static int passresults (lua_State *L, int status, int oldtop) { | |||
| 206 | if (nresults > 0) | 206 | if (nresults > 0) |
| 207 | return nresults; /* results are already on the stack */ | 207 | return nresults; /* results are already on the stack */ |
| 208 | else { | 208 | else { |
| 209 | lua_newuserdatabox(L, NULL); /* at least one result to signal no errors */ | 209 | lua_pushboolean(L, 1); /* at least one result to signal no errors */ |
| 210 | return 1; | 210 | return 1; |
| 211 | } | 211 | } |
| 212 | } | 212 | } |
| @@ -383,6 +383,7 @@ static int luaB_tostring (lua_State *L) { | |||
| 383 | sprintf(buff, "function: %p", lua_topointer(L, 1)); | 383 | sprintf(buff, "function: %p", lua_topointer(L, 1)); |
| 384 | break; | 384 | break; |
| 385 | case LUA_TUSERDATA: | 385 | case LUA_TUSERDATA: |
| 386 | case LUA_TUDATAVAL: | ||
| 386 | sprintf(buff, "userdata: %p", lua_touserdata(L, 1)); | 387 | sprintf(buff, "userdata: %p", lua_touserdata(L, 1)); |
| 387 | break; | 388 | break; |
| 388 | case LUA_TNIL: | 389 | case LUA_TNIL: |
| @@ -439,7 +440,7 @@ static void base_open (lua_State *L) { | |||
| 439 | 440 | ||
| 440 | 441 | ||
| 441 | static int luaB_resume (lua_State *L) { | 442 | static int luaB_resume (lua_State *L) { |
| 442 | lua_State *co = (lua_State *)lua_touserdata(L, lua_upvalueindex(1)); | 443 | lua_State *co = (lua_State *)lua_getfrombox(L, lua_upvalueindex(1)); |
| 443 | if (lua_resume(L, co) != 0) | 444 | if (lua_resume(L, co) != 0) |
| 444 | lua_error(L, "error running co-routine"); | 445 | lua_error(L, "error running co-routine"); |
| 445 | return lua_gettop(L); | 446 | return lua_gettop(L); |
| @@ -448,7 +449,7 @@ static int luaB_resume (lua_State *L) { | |||
| 448 | 449 | ||
| 449 | 450 | ||
| 450 | static int gc_coroutine (lua_State *L) { | 451 | static int gc_coroutine (lua_State *L) { |
| 451 | lua_State *co = (lua_State *)lua_touserdata(L, 1); | 452 | lua_State *co = (lua_State *)lua_getfrombox(L, 1); |
| 452 | lua_closethread(L, co); | 453 | lua_closethread(L, co); |
| 453 | return 0; | 454 | return 0; |
| 454 | } | 455 | } |
| @@ -471,7 +472,7 @@ static int luaB_coroutine (lua_State *L) { | |||
| 471 | lua_unref(L, ref); | 472 | lua_unref(L, ref); |
| 472 | } | 473 | } |
| 473 | lua_cobegin(NL, n-1); | 474 | lua_cobegin(NL, n-1); |
| 474 | lua_newuserdatabox(L, NL); | 475 | lua_newpointerbox(L, NL); |
| 475 | lua_pushliteral(L, "Coroutine"); | 476 | lua_pushliteral(L, "Coroutine"); |
| 476 | lua_rawget(L, LUA_REGISTRYINDEX); | 477 | lua_rawget(L, LUA_REGISTRYINDEX); |
| 477 | lua_setmetatable(L, -2); | 478 | lua_setmetatable(L, -2); |
