diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2009-10-05 13:44:33 -0300 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2009-10-05 13:44:33 -0300 |
commit | a5382b763c2faa4c47e55ee0e49889b4c47daac4 (patch) | |
tree | d5f4ea49f2343593ced46ce303783baf0cb2cd56 /lstate.c | |
parent | ba21aa8b2b29f516f1f488f996fc899c62f7105b (diff) | |
download | lua-a5382b763c2faa4c47e55ee0e49889b4c47daac4.tar.gz lua-a5382b763c2faa4c47e55ee0e49889b4c47daac4.tar.bz2 lua-a5382b763c2faa4c47e55ee0e49889b4c47daac4.zip |
new function lua_copy
Diffstat (limited to 'lstate.c')
-rw-r--r-- | lstate.c | 5 |
1 files changed, 2 insertions, 3 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lstate.c,v 2.60 2009/09/28 13:50:19 roberto Exp roberto $ | 2 | ** $Id: lstate.c,v 2.61 2009/09/30 20:49:47 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 | */ |
@@ -100,8 +100,7 @@ static int cpcall (lua_State *L) { | |||
100 | lua_CFunction f = *(lua_CFunction *)lua_touserdata(L, 1); | 100 | lua_CFunction f = *(lua_CFunction *)lua_touserdata(L, 1); |
101 | lua_remove(L, 1); /* remove f from stack */ | 101 | lua_remove(L, 1); /* remove f from stack */ |
102 | /* restore original environment for 'cpcall' */ | 102 | /* restore original environment for 'cpcall' */ |
103 | lua_pushvalue(L, LUA_GLOBALSINDEX); | 103 | lua_copy(L, LUA_GLOBALSINDEX, LUA_ENVIRONINDEX); |
104 | lua_replace(L, LUA_ENVIRONINDEX); | ||
105 | return f(L); | 104 | return f(L); |
106 | } | 105 | } |
107 | 106 | ||