aboutsummaryrefslogtreecommitdiff
path: root/lstate.c
diff options
context:
space:
mode:
Diffstat (limited to 'lstate.c')
-rw-r--r--lstate.c7
1 files changed, 2 insertions, 5 deletions
diff --git a/lstate.c b/lstate.c
index b00b62a1..d47e01c8 100644
--- a/lstate.c
+++ b/lstate.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: lstate.c,v 2.73 2010/03/25 13:06:36 roberto Exp roberto $ 2** $Id: lstate.c,v 2.74 2010/03/25 19:37:23 roberto Exp roberto $
3** Global State 3** Global State
4** See Copyright Notice in lua.h 4** See Copyright Notice in lua.h
5*/ 5*/
@@ -118,9 +118,6 @@ static void freestack (lua_State *L) {
118static int ccall (lua_State *L) { 118static int ccall (lua_State *L) {
119 lua_CFunction f = *(lua_CFunction *)lua_touserdata(L, 1); 119 lua_CFunction f = *(lua_CFunction *)lua_touserdata(L, 1);
120 lua_remove(L, 1); /* remove f from stack */ 120 lua_remove(L, 1); /* remove f from stack */
121 /* restore original environment for 'ccall' */
122 lua_pushglobaltable(L);
123 lua_replace(L, LUA_ENVIRONINDEX);
124 return f(L); 121 return f(L);
125} 122}
126 123
@@ -139,7 +136,7 @@ static void init_registry (lua_State *L, global_State *g) {
139 setthvalue(L, &mt, L); 136 setthvalue(L, &mt, L);
140 setobj2t(L, luaH_setint(L, registry, LUA_RIDX_MAINTHREAD), &mt); 137 setobj2t(L, luaH_setint(L, registry, LUA_RIDX_MAINTHREAD), &mt);
141 /* registry[LUA_RIDX_CCALL] = ccall */ 138 /* registry[LUA_RIDX_CCALL] = ccall */
142 cp = luaF_newCclosure(L, 0, g->l_gt); 139 cp = luaF_newCclosure(L, 0);
143 cp->c.f = ccall; 140 cp->c.f = ccall;
144 setclvalue(L, &mt, cp); 141 setclvalue(L, &mt, cp);
145 setobj2t(L, luaH_setint(L, registry, LUA_RIDX_CCALL), &mt); 142 setobj2t(L, luaH_setint(L, registry, LUA_RIDX_CCALL), &mt);