diff options
Diffstat (limited to 'ltests.c')
-rw-r--r-- | ltests.c | 25 |
1 files changed, 17 insertions, 8 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: ltests.c,v 1.148 2002/12/04 17:38:31 roberto Exp roberto $ | 2 | ** $Id: ltests.c,v 1.149 2002/12/19 11:11: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 | */ |
@@ -457,13 +457,21 @@ static int newstate (lua_State *L) { | |||
457 | return 1; | 457 | return 1; |
458 | } | 458 | } |
459 | 459 | ||
460 | |||
460 | static int loadlib (lua_State *L) { | 461 | static int loadlib (lua_State *L) { |
461 | lua_State *L1 = cast(lua_State *, cast(unsigned long, luaL_checknumber(L, 1))); | 462 | static const luaL_reg libs[] = { |
462 | lua_register(L1, "mathlibopen", lua_mathlibopen); | 463 | {"mathlibopen", lua_mathlibopen}, |
463 | lua_register(L1, "strlibopen", lua_strlibopen); | 464 | {"strlibopen", lua_strlibopen}, |
464 | lua_register(L1, "iolibopen", lua_iolibopen); | 465 | {"iolibopen", lua_iolibopen}, |
465 | lua_register(L1, "dblibopen", lua_dblibopen); | 466 | {"tablibopen", lua_tablibopen}, |
466 | lua_register(L1, "baselibopen", lua_baselibopen); | 467 | {"dblibopen", lua_dblibopen}, |
468 | {"baselibopen", lua_baselibopen}, | ||
469 | {NULL, NULL} | ||
470 | }; | ||
471 | lua_State *L1 = cast(lua_State *, | ||
472 | cast(unsigned long, luaL_checknumber(L, 1))); | ||
473 | lua_pushvalue(L1, LUA_GLOBALSINDEX); | ||
474 | luaL_openlib(L1, NULL, libs, 0); | ||
467 | return 0; | 475 | return 0; |
468 | } | 476 | } |
469 | 477 | ||
@@ -486,7 +494,8 @@ static int doremote (lua_State *L) { | |||
486 | if (status != 0) { | 494 | if (status != 0) { |
487 | lua_pushnil(L); | 495 | lua_pushnil(L); |
488 | lua_pushnumber(L, status); | 496 | lua_pushnumber(L, status); |
489 | return 2; | 497 | lua_pushstring(L, lua_tostring(L1, -1)); |
498 | return 3; | ||
490 | } | 499 | } |
491 | else { | 500 | else { |
492 | int i = 0; | 501 | int i = 0; |