diff options
| author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2005-03-07 15:07:34 -0300 |
|---|---|---|
| committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2005-03-07 15:07:34 -0300 |
| commit | 1e48b20ce014c58c639f2d9034f41493bc87d7f1 (patch) | |
| tree | 1f71f540bebde663f2a42c36bd1c1dfcbd39c96f | |
| parent | d1ed6e4c073c85c5f9a35f5a12adb3fc7c21c2c5 (diff) | |
| download | lua-1e48b20ce014c58c639f2d9034f41493bc87d7f1.tar.gz lua-1e48b20ce014c58c639f2d9034f41493bc87d7f1.tar.bz2 lua-1e48b20ce014c58c639f2d9034f41493bc87d7f1.zip | |
`loadlib' not global anymore (packaged inside `package')
| -rw-r--r-- | loadlib.c | 8 |
1 files changed, 6 insertions, 2 deletions
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: loadlib.c,v 1.17 2005/02/18 12:40:02 roberto Exp roberto $ | 2 | ** $Id: loadlib.c,v 1.18 2005/02/28 15:58:48 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 | * |
| @@ -434,7 +434,6 @@ static int ll_module (lua_State *L) { | |||
| 434 | 434 | ||
| 435 | 435 | ||
| 436 | static const luaL_reg ll_funcs[] = { | 436 | static const luaL_reg ll_funcs[] = { |
| 437 | {"loadlib", ll_loadlib}, | ||
| 438 | {"require", ll_require}, | 437 | {"require", ll_require}, |
| 439 | {"module", ll_module}, | 438 | {"module", ll_module}, |
| 440 | {NULL, NULL} | 439 | {NULL, NULL} |
| @@ -485,6 +484,11 @@ LUALIB_API int luaopen_loadlib (lua_State *L) { | |||
| 485 | /* set field `preload' */ | 484 | /* set field `preload' */ |
| 486 | lua_newtable(L); | 485 | lua_newtable(L); |
| 487 | lua_setfield(L, -2, "preload"); | 486 | lua_setfield(L, -2, "preload"); |
| 487 | /* create `loadlib' function */ | ||
| 488 | lua_pushcfunction(L, ll_loadlib); | ||
| 489 | lua_pushvalue(L, -1); | ||
| 490 | lua_setfield(L, LUA_GLOBALSINDEX, "loadlib"); /* COMPATIBILITY ONLY!! */ | ||
| 491 | lua_setfield(L, -2, "loadlib"); | ||
| 488 | lua_pushvalue(L, LUA_GLOBALSINDEX); | 492 | lua_pushvalue(L, LUA_GLOBALSINDEX); |
| 489 | luaL_openlib(L, NULL, ll_funcs, 0); /* open lib into global table */ | 493 | luaL_openlib(L, NULL, ll_funcs, 0); /* open lib into global table */ |
| 490 | return 1; | 494 | return 1; |
