aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lauxlib.c14
-rw-r--r--lauxlib.h4
-rw-r--r--ldblib.c4
-rw-r--r--linit.c4
-rw-r--r--loadlib.c6
-rw-r--r--ltests.c4
6 files changed, 18 insertions, 18 deletions
diff --git a/lauxlib.c b/lauxlib.c
index 777b1aaf..bcd4fa1d 100644
--- a/lauxlib.c
+++ b/lauxlib.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: lauxlib.c,v 1.228 2011/01/10 15:51:42 roberto Exp roberto $ 2** $Id: lauxlib.c,v 1.229 2011/03/03 16:34:46 roberto Exp roberto $
3** Auxiliary functions for building Lua libraries 3** Auxiliary functions for building Lua libraries
4** See Copyright Notice in lua.h 4** See Copyright Notice in lua.h
5*/ 5*/
@@ -758,8 +758,8 @@ LUALIB_API const char *luaL_tolstring (lua_State *L, int idx, size_t *len) {
758*/ 758*/
759#if defined(LUA_COMPAT_MODULE) 759#if defined(LUA_COMPAT_MODULE)
760 760
761static const char *luaL_findtablex (lua_State *L, int idx, 761static const char *luaL_findtable (lua_State *L, int idx,
762 const char *fname, int szhint) { 762 const char *fname, int szhint) {
763 const char *e; 763 const char *e;
764 if (idx) lua_pushvalue(L, idx); 764 if (idx) lua_pushvalue(L, idx);
765 do { 765 do {
@@ -803,13 +803,13 @@ static int libsize (const luaL_Reg *l) {
803*/ 803*/
804LUALIB_API void luaL_pushmodule (lua_State *L, const char *modname, 804LUALIB_API void luaL_pushmodule (lua_State *L, const char *modname,
805 int sizehint) { 805 int sizehint) {
806 luaL_findtablex(L, LUA_REGISTRYINDEX, "_LOADED", 1); /* get _LOADED table */ 806 luaL_findtable(L, LUA_REGISTRYINDEX, "_LOADED", 1); /* get _LOADED table */
807 lua_getfield(L, -1, modname); /* get _LOADED[modname] */ 807 lua_getfield(L, -1, modname); /* get _LOADED[modname] */
808 if (!lua_istable(L, -1)) { /* not found? */ 808 if (!lua_istable(L, -1)) { /* not found? */
809 lua_pop(L, 1); /* remove previous result */ 809 lua_pop(L, 1); /* remove previous result */
810 /* try global variable (and create one if it does not exist) */ 810 /* try global variable (and create one if it does not exist) */
811 lua_pushglobaltable(L); 811 lua_pushglobaltable(L);
812 if (luaL_findtablex(L, 0, modname, sizehint) != NULL) 812 if (luaL_findtable(L, 0, modname, sizehint) != NULL)
813 luaL_error(L, "name conflict for module " LUA_QS, modname); 813 luaL_error(L, "name conflict for module " LUA_QS, modname);
814 lua_pushvalue(L, -1); 814 lua_pushvalue(L, -1);
815 lua_setfield(L, -3, modname); /* _LOADED[modname] = new table */ 815 lua_setfield(L, -3, modname); /* _LOADED[modname] = new table */
@@ -853,7 +853,7 @@ LUALIB_API void luaL_setfuncs (lua_State *L, const luaL_Reg *l, int nup) {
853** ensure that stack[idx][fname] has a table and push that table 853** ensure that stack[idx][fname] has a table and push that table
854** into the stack 854** into the stack
855*/ 855*/
856LUALIB_API int luaL_findtable (lua_State *L, int idx, const char *fname) { 856LUALIB_API int luaL_getsubtable (lua_State *L, int idx, const char *fname) {
857 lua_getfield(L, idx, fname); 857 lua_getfield(L, idx, fname);
858 if (lua_istable(L, -1)) return 1; /* table already there */ 858 if (lua_istable(L, -1)) return 1; /* table already there */
859 else { 859 else {
@@ -878,7 +878,7 @@ LUALIB_API void luaL_requiref (lua_State *L, const char *modname,
878 lua_pushcfunction(L, openf); 878 lua_pushcfunction(L, openf);
879 lua_pushstring(L, modname); /* argument to open function */ 879 lua_pushstring(L, modname); /* argument to open function */
880 lua_call(L, 1, 1); /* open module */ 880 lua_call(L, 1, 1); /* open module */
881 luaL_findtable(L, LUA_REGISTRYINDEX, "_LOADED"); 881 luaL_getsubtable(L, LUA_REGISTRYINDEX, "_LOADED");
882 lua_pushvalue(L, -2); /* make copy of module (call result) */ 882 lua_pushvalue(L, -2); /* make copy of module (call result) */
883 lua_setfield(L, -2, modname); /* _LOADED[modname] = module */ 883 lua_setfield(L, -2, modname); /* _LOADED[modname] = module */
884 lua_pop(L, 1); /* remove _LOADED table */ 884 lua_pop(L, 1); /* remove _LOADED table */
diff --git a/lauxlib.h b/lauxlib.h
index 3123ef25..be36b0a9 100644
--- a/lauxlib.h
+++ b/lauxlib.h
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: lauxlib.h,v 1.114 2011/01/10 15:51:42 roberto Exp roberto $ 2** $Id: lauxlib.h,v 1.115 2011/03/03 16:34:46 roberto Exp roberto $
3** Auxiliary functions for building Lua libraries 3** Auxiliary functions for building Lua libraries
4** See Copyright Notice in lua.h 4** See Copyright Notice in lua.h
5*/ 5*/
@@ -86,7 +86,7 @@ LUALIB_API const char *(luaL_gsub) (lua_State *L, const char *s, const char *p,
86 86
87LUALIB_API void (luaL_setfuncs) (lua_State *L, const luaL_Reg *l, int nup); 87LUALIB_API void (luaL_setfuncs) (lua_State *L, const luaL_Reg *l, int nup);
88 88
89LUALIB_API int (luaL_findtable) (lua_State *L, int idx, const char *fname); 89LUALIB_API int (luaL_getsubtable) (lua_State *L, int idx, const char *fname);
90 90
91LUALIB_API void (luaL_traceback) (lua_State *L, lua_State *L1, 91LUALIB_API void (luaL_traceback) (lua_State *L, lua_State *L1,
92 const char *msg, int level); 92 const char *msg, int level);
diff --git a/ldblib.c b/ldblib.c
index ad4c62ca..571f9773 100644
--- a/ldblib.c
+++ b/ldblib.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: ldblib.c,v 1.128 2011/01/10 15:51:19 roberto Exp roberto $ 2** $Id: ldblib.c,v 1.129 2011/01/26 16:30:02 roberto Exp roberto $
3** Interface from Lua to its debug API 3** Interface from Lua to its debug API
4** See Copyright Notice in lua.h 4** See Copyright Notice in lua.h
5*/ 5*/
@@ -253,7 +253,7 @@ static int db_upvaluejoin (lua_State *L) {
253} 253}
254 254
255 255
256#define gethooktable(L) luaL_findtable(L, LUA_REGISTRYINDEX, HOOKKEY); 256#define gethooktable(L) luaL_getsubtable(L, LUA_REGISTRYINDEX, HOOKKEY);
257 257
258 258
259static void hookf (lua_State *L, lua_Debug *ar) { 259static void hookf (lua_State *L, lua_Debug *ar) {
diff --git a/linit.c b/linit.c
index a3c31a7b..8fd67fcd 100644
--- a/linit.c
+++ b/linit.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: linit.c,v 1.30 2010/11/12 15:48:30 roberto Exp roberto $ 2** $Id: linit.c,v 1.31 2011/01/26 16:30:02 roberto Exp roberto $
3** Initialization of libraries for lua.c and other clients 3** Initialization of libraries for lua.c and other clients
4** See Copyright Notice in lua.h 4** See Copyright Notice in lua.h
5*/ 5*/
@@ -57,7 +57,7 @@ LUALIB_API void luaL_openlibs (lua_State *L) {
57 lua_pop(L, 1); /* remove lib */ 57 lua_pop(L, 1); /* remove lib */
58 } 58 }
59 /* add open functions from 'preloadedlibs' into 'package.preload' table */ 59 /* add open functions from 'preloadedlibs' into 'package.preload' table */
60 luaL_findtable(L, LUA_REGISTRYINDEX, "_PRELOAD"); 60 luaL_getsubtable(L, LUA_REGISTRYINDEX, "_PRELOAD");
61 for (lib = preloadedlibs; lib->func; lib++) { 61 for (lib = preloadedlibs; lib->func; lib++) {
62 lua_pushcfunction(L, lib->func); 62 lua_pushcfunction(L, lib->func);
63 lua_setfield(L, -2, lib->name); 63 lua_setfield(L, -2, lib->name);
diff --git a/loadlib.c b/loadlib.c
index e90b5355..97b07eea 100644
--- a/loadlib.c
+++ b/loadlib.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: loadlib.c,v 1.96 2011/02/07 19:15:24 roberto Exp roberto $ 2** $Id: loadlib.c,v 1.97 2011/03/01 17:01:53 roberto Exp roberto $
3** Dynamic library loader for Lua 3** Dynamic library loader for Lua
4** See Copyright Notice in lua.h 4** See Copyright Notice in lua.h
5** 5**
@@ -652,10 +652,10 @@ LUAMOD_API int luaopen_package (lua_State *L) {
652 LUA_EXEC_DIR "\n" LUA_IGMARK "\n"); 652 LUA_EXEC_DIR "\n" LUA_IGMARK "\n");
653 lua_setfield(L, -2, "config"); 653 lua_setfield(L, -2, "config");
654 /* set field `loaded' */ 654 /* set field `loaded' */
655 luaL_findtable(L, LUA_REGISTRYINDEX, "_LOADED"); 655 luaL_getsubtable(L, LUA_REGISTRYINDEX, "_LOADED");
656 lua_setfield(L, -2, "loaded"); 656 lua_setfield(L, -2, "loaded");
657 /* set field `preload' */ 657 /* set field `preload' */
658 luaL_findtable(L, LUA_REGISTRYINDEX, "_PRELOAD"); 658 luaL_getsubtable(L, LUA_REGISTRYINDEX, "_PRELOAD");
659 lua_setfield(L, -2, "preload"); 659 lua_setfield(L, -2, "preload");
660 lua_pushglobaltable(L); 660 lua_pushglobaltable(L);
661 lua_pushvalue(L, -2); /* set 'package' as upvalue for next lib */ 661 lua_pushvalue(L, -2); /* set 'package' as upvalue for next lib */
diff --git a/ltests.c b/ltests.c
index 16b13dd1..888a3c48 100644
--- a/ltests.c
+++ b/ltests.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: ltests.c,v 2.114 2010/11/26 14:32:31 roberto Exp roberto $ 2** $Id: ltests.c,v 2.115 2010/12/10 13:40:22 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*/
@@ -853,7 +853,7 @@ static int loadlib (lua_State *L) {
853 lua_State *L1 = getstate(L); 853 lua_State *L1 = getstate(L);
854 int i; 854 int i;
855 luaL_requiref(L1, "package", luaopen_package, 1); 855 luaL_requiref(L1, "package", luaopen_package, 1);
856 luaL_findtable(L1, LUA_REGISTRYINDEX, "_PRELOAD"); 856 luaL_getsubtable(L1, LUA_REGISTRYINDEX, "_PRELOAD");
857 for (i = 0; libs[i].name; i++) { 857 for (i = 0; libs[i].name; i++) {
858 lua_pushcfunction(L1, libs[i].func); 858 lua_pushcfunction(L1, libs[i].func);
859 lua_setfield(L1, -2, libs[i].name); 859 lua_setfield(L1, -2, libs[i].name);