aboutsummaryrefslogtreecommitdiff
path: root/linit.c
diff options
context:
space:
mode:
Diffstat (limited to 'linit.c')
-rw-r--r--linit.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/linit.c b/linit.c
index 96193423..7eb3cfbd 100644
--- a/linit.c
+++ b/linit.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: linit.c,v 1.16 2008/01/02 16:16:28 roberto Exp roberto $ 2** $Id: linit.c,v 1.17 2009/05/01 13:37:11 roberto Exp roberto $
3** Initialization of libraries for lua.c 3** Initialization of libraries for lua.c
4** See Copyright Notice in lua.h 4** See Copyright Notice in lua.h
5*/ 5*/
@@ -17,7 +17,7 @@
17/* 17/*
18** these libs are loaded by lua.c and are readily available to any program 18** these libs are loaded by lua.c and are readily available to any program
19*/ 19*/
20static const luaL_Reg lualibs[] = { 20static const luaL_Reg loadedlibs[] = {
21 {"_G", luaopen_base}, 21 {"_G", luaopen_base},
22 {LUA_LOADLIBNAME, luaopen_package}, 22 {LUA_LOADLIBNAME, luaopen_package},
23 {LUA_TABLIBNAME, luaopen_table}, 23 {LUA_TABLIBNAME, luaopen_table},
@@ -32,22 +32,22 @@ static const luaL_Reg lualibs[] = {
32/* 32/*
33** these libs are preloaded and must be required before used 33** these libs are preloaded and must be required before used
34*/ 34*/
35static const luaL_Reg luareqlibs[] = { 35static const luaL_Reg preloadedlibs[] = {
36 {LUA_DBLIBNAME, luaopen_debug}, 36 {LUA_DBLIBNAME, luaopen_debug},
37 {NULL, NULL} 37 {NULL, NULL}
38}; 38};
39 39
40 40
41LUALIB_API void luaL_openlibs (lua_State *L) { 41LUALIB_API void luaL_openlibs (lua_State *L) {
42 /* call open functions from 'lualibs' */ 42 /* call open functions from 'loadedlibs' */
43 const luaL_Reg *lib = lualibs; 43 const luaL_Reg *lib = loadedlibs;
44 for (; lib->func; lib++) { 44 for (; lib->func; lib++) {
45 lua_pushcfunction(L, lib->func); 45 lua_pushcfunction(L, lib->func);
46 lua_pushstring(L, lib->name); 46 lua_pushstring(L, lib->name);
47 lua_call(L, 1, 0); 47 lua_call(L, 1, 0);
48 } 48 }
49 /* add open functions from 'luareqlibs' into 'package.preload' table */ 49 /* add open functions from 'preloadedlibs' into 'package.preload' table */
50 lib = luareqlibs; 50 lib = preloadedlibs;
51 luaL_findtable(L, LUA_GLOBALSINDEX, "package.preload", 0); 51 luaL_findtable(L, LUA_GLOBALSINDEX, "package.preload", 0);
52 for (; lib->func; lib++) { 52 for (; lib->func; lib++) {
53 lua_pushcfunction(L, lib->func); 53 lua_pushcfunction(L, lib->func);