lua

A copy of the Lua development repository
Log | Files | Refs | README

commit 1e48b20ce014c58c639f2d9034f41493bc87d7f1
parent d1ed6e4c073c85c5f9a35f5a12adb3fc7c21c2c5
Author: Roberto Ierusalimschy <roberto@inf.puc-rio.br>
Date:   Mon,  7 Mar 2005 15:07:12 -0300

`loadlib' not global anymore (packaged inside `package')

Diffstat:
Mloadlib.c | 8++++++--
1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/loadlib.c b/loadlib.c @@ -1,5 +1,5 @@ /* -** $Id: loadlib.c,v 1.17 2005/02/18 12:40:02 roberto Exp roberto $ +** $Id: loadlib.c,v 1.18 2005/02/28 15:58:48 roberto Exp roberto $ ** Dynamic library loader for Lua ** See Copyright Notice in lua.h * @@ -434,7 +434,6 @@ static int ll_module (lua_State *L) { static const luaL_reg ll_funcs[] = { - {"loadlib", ll_loadlib}, {"require", ll_require}, {"module", ll_module}, {NULL, NULL} @@ -485,6 +484,11 @@ LUALIB_API int luaopen_loadlib (lua_State *L) { /* set field `preload' */ lua_newtable(L); lua_setfield(L, -2, "preload"); + /* create `loadlib' function */ + lua_pushcfunction(L, ll_loadlib); + lua_pushvalue(L, -1); + lua_setfield(L, LUA_GLOBALSINDEX, "loadlib"); /* COMPATIBILITY ONLY!! */ + lua_setfield(L, -2, "loadlib"); lua_pushvalue(L, LUA_GLOBALSINDEX); luaL_openlib(L, NULL, ll_funcs, 0); /* open lib into global table */ return 1;