aboutsummaryrefslogtreecommitdiff
path: root/loadlib.c
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2009-10-05 13:44:33 -0300
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2009-10-05 13:44:33 -0300
commita5382b763c2faa4c47e55ee0e49889b4c47daac4 (patch)
treed5f4ea49f2343593ced46ce303783baf0cb2cd56 /loadlib.c
parentba21aa8b2b29f516f1f488f996fc899c62f7105b (diff)
downloadlua-a5382b763c2faa4c47e55ee0e49889b4c47daac4.tar.gz
lua-a5382b763c2faa4c47e55ee0e49889b4c47daac4.tar.bz2
lua-a5382b763c2faa4c47e55ee0e49889b4c47daac4.zip
new function lua_copy
Diffstat (limited to 'loadlib.c')
-rw-r--r--loadlib.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/loadlib.c b/loadlib.c
index d21c654f..3e807c2c 100644
--- a/loadlib.c
+++ b/loadlib.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: loadlib.c,v 1.64 2009/07/15 17:49:48 roberto Exp roberto $ 2** $Id: loadlib.c,v 1.65 2009/09/07 14:24:12 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**
@@ -655,8 +655,7 @@ LUALIB_API int luaopen_package (lua_State *L) {
655 lua_setfield(L, -2, "__gc"); 655 lua_setfield(L, -2, "__gc");
656 /* create `package' table */ 656 /* create `package' table */
657 luaL_register(L, LUA_LOADLIBNAME, pk_funcs); 657 luaL_register(L, LUA_LOADLIBNAME, pk_funcs);
658 lua_pushvalue(L, -1); 658 lua_copy(L, -1, LUA_ENVIRONINDEX);
659 lua_replace(L, LUA_ENVIRONINDEX);
660 /* create `loaders' table */ 659 /* create `loaders' table */
661 lua_createtable(L, sizeof(loaders)/sizeof(loaders[0]) - 1, 0); 660 lua_createtable(L, sizeof(loaders)/sizeof(loaders[0]) - 1, 0);
662 /* fill it with pre-defined loaders */ 661 /* fill it with pre-defined loaders */