summaryrefslogtreecommitdiff
path: root/linit.c
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2005-02-18 10:40:02 -0200
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2005-02-18 10:40:02 -0200
commit7d45a5f48ff32a4e09a1734de23823943d6a6b28 (patch)
treede7bef1faf37d9b639928e5269e89d7112b5b6fa /linit.c
parent73d764024451c24bc43b8e5102fe90974a86b7f4 (diff)
downloadlua-7d45a5f48ff32a4e09a1734de23823943d6a6b28.tar.gz
lua-7d45a5f48ff32a4e09a1734de23823943d6a6b28.tar.bz2
lua-7d45a5f48ff32a4e09a1734de23823943d6a6b28.zip
C functions and userdata also have environments
Diffstat (limited to '')
-rw-r--r--linit.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/linit.c b/linit.c
index a50b894e..da414468 100644
--- a/linit.c
+++ b/linit.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: linit.c,v 1.7 2004/07/09 14:29:29 roberto Exp roberto $ 2** $Id: linit.c,v 1.8 2004/07/09 15:47:48 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*/
@@ -32,6 +32,8 @@ LUALIB_API int luaopen_stdlibs (lua_State *L) {
32 for (; lib->func; lib++) { 32 for (; lib->func; lib++) {
33 lib->func(L); /* open library */ 33 lib->func(L); /* open library */
34 lua_settop(L, 0); /* discard any results */ 34 lua_settop(L, 0); /* discard any results */
35 lua_pushvalue(L, LUA_GLOBALSINDEX);
36 lua_replace(L, LUA_ENVIRONINDEX); /* restore environment */
35 } 37 }
36 return 0; 38 return 0;
37} 39}