variable renaming: 'lualibs' -> 'loadedlibs'; 'luareqlibs' ->

'preloadedlibs'
This commit is contained in:
Roberto Ierusalimschy 2009-05-01 10:46:35 -03:00
parent 71c2eeff98
commit 0cc3add9f8
1 changed files with 7 additions and 7 deletions

14
linit.c
View File

@ -1,5 +1,5 @@
/* /*
** $Id: linit.c,v 1.16 2008/01/02 16:16:28 roberto Exp roberto $ ** $Id: linit.c,v 1.17 2009/05/01 13:37:11 roberto Exp roberto $
** Initialization of libraries for lua.c ** Initialization of libraries for lua.c
** See Copyright Notice in lua.h ** See Copyright Notice in lua.h
*/ */
@ -17,7 +17,7 @@
/* /*
** these libs are loaded by lua.c and are readily available to any program ** these libs are loaded by lua.c and are readily available to any program
*/ */
static const luaL_Reg lualibs[] = { static const luaL_Reg loadedlibs[] = {
{"_G", luaopen_base}, {"_G", luaopen_base},
{LUA_LOADLIBNAME, luaopen_package}, {LUA_LOADLIBNAME, luaopen_package},
{LUA_TABLIBNAME, luaopen_table}, {LUA_TABLIBNAME, luaopen_table},
@ -32,22 +32,22 @@ static const luaL_Reg lualibs[] = {
/* /*
** these libs are preloaded and must be required before used ** these libs are preloaded and must be required before used
*/ */
static const luaL_Reg luareqlibs[] = { static const luaL_Reg preloadedlibs[] = {
{LUA_DBLIBNAME, luaopen_debug}, {LUA_DBLIBNAME, luaopen_debug},
{NULL, NULL} {NULL, NULL}
}; };
LUALIB_API void luaL_openlibs (lua_State *L) { LUALIB_API void luaL_openlibs (lua_State *L) {
/* call open functions from 'lualibs' */ /* call open functions from 'loadedlibs' */
const luaL_Reg *lib = lualibs; const luaL_Reg *lib = loadedlibs;
for (; lib->func; lib++) { for (; lib->func; lib++) {
lua_pushcfunction(L, lib->func); lua_pushcfunction(L, lib->func);
lua_pushstring(L, lib->name); lua_pushstring(L, lib->name);
lua_call(L, 1, 0); lua_call(L, 1, 0);
} }
/* add open functions from 'luareqlibs' into 'package.preload' table */ /* add open functions from 'preloadedlibs' into 'package.preload' table */
lib = luareqlibs; lib = preloadedlibs;
luaL_findtable(L, LUA_GLOBALSINDEX, "package.preload", 0); luaL_findtable(L, LUA_GLOBALSINDEX, "package.preload", 0);
for (; lib->func; lib++) { for (; lib->func; lib++) {
lua_pushcfunction(L, lib->func); lua_pushcfunction(L, lib->func);