summaryrefslogtreecommitdiff
path: root/ltests.c
diff options
context:
space:
mode:
Diffstat (limited to 'ltests.c')
-rw-r--r--ltests.c28
1 files changed, 16 insertions, 12 deletions
diff --git a/ltests.c b/ltests.c
index 7bafe829..ec70a954 100644
--- a/ltests.c
+++ b/ltests.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: ltests.c,v 2.109 2010/06/10 21:29:47 roberto Exp roberto $ 2** $Id: ltests.c,v 2.110 2010/06/25 12:18:10 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*/
@@ -841,19 +841,23 @@ static lua_State *getstate (lua_State *L) {
841 841
842static int loadlib (lua_State *L) { 842static int loadlib (lua_State *L) {
843 static const luaL_Reg libs[] = { 843 static const luaL_Reg libs[] = {
844 {"baselibopen", luaopen_base}, 844 {"_G", luaopen_base},
845 {"corolibopen", luaopen_coroutine}, 845 {"coroutine", luaopen_coroutine},
846 {"dblibopen", luaopen_debug}, 846 {"debug", luaopen_debug},
847 {"iolibopen", luaopen_io}, 847 {"io", luaopen_io},
848 {"mathlibopen", luaopen_math}, 848 {"math", luaopen_math},
849 {"strlibopen", luaopen_string}, 849 {"string", luaopen_string},
850 {"tablibopen", luaopen_table}, 850 {"table", luaopen_table},
851 {"packageopen", luaopen_package},
852 {NULL, NULL} 851 {NULL, NULL}
853 }; 852 };
854 lua_State *L1 = getstate(L); 853 lua_State *L1 = getstate(L);
855 lua_pushglobaltable(L1); 854 int i;
856 luaL_register(L1, NULL, libs); 855 luaL_requiref(L1, "package", luaopen_package, 1);
856 luaL_findtable(L1, LUA_REGISTRYINDEX, "_PRELOAD");
857 for (i = 0; libs[i].name; i++) {
858 lua_pushcfunction(L1, libs[i].func);
859 lua_setfield(L1, -2, libs[i].name);
860 }
857 return 0; 861 return 0;
858} 862}
859 863
@@ -874,8 +878,8 @@ static int doremote (lua_State *L) {
874 status = lua_pcall(L1, 0, LUA_MULTRET, 0); 878 status = lua_pcall(L1, 0, LUA_MULTRET, 0);
875 if (status != LUA_OK) { 879 if (status != LUA_OK) {
876 lua_pushnil(L); 880 lua_pushnil(L);
877 lua_pushinteger(L, status);
878 lua_pushstring(L, lua_tostring(L1, -1)); 881 lua_pushstring(L, lua_tostring(L1, -1));
882 lua_pushinteger(L, status);
879 return 3; 883 return 3;
880 } 884 }
881 else { 885 else {