aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2005-08-18 13:04:05 -0300
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2005-08-18 13:04:05 -0300
commit3b828d9e48caefdf4656f9920bf45c395f0f04d2 (patch)
treeadada16de1720af7ab3f3ed9a7688b2ba36c17a6
parent68548a02d39861176b59f58be93315b51eafdbe2 (diff)
downloadlua-3b828d9e48caefdf4656f9920bf45c395f0f04d2.tar.gz
lua-3b828d9e48caefdf4656f9920bf45c395f0f04d2.tar.bz2
lua-3b828d9e48caefdf4656f9920bf45c395f0f04d2.zip
luaL_setfield does a non-raw set
-rw-r--r--lauxlib.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/lauxlib.c b/lauxlib.c
index 698fba24..90bd3668 100644
--- a/lauxlib.c
+++ b/lauxlib.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: lauxlib.c,v 1.145 2005/08/17 19:05:04 roberto Exp roberto $ 2** $Id: lauxlib.c,v 1.146 2005/08/17 20:09:31 roberto Exp roberto $
3** Auxiliary functions for building Lua libraries 3** Auxiliary functions for building Lua libraries
4** See Copyright Notice in lua.h 4** See Copyright Notice in lua.h
5*/ 5*/
@@ -388,9 +388,8 @@ LUALIB_API const char *luaL_setfield (lua_State *L, int idx,
388 return fname; 388 return fname;
389 } 389 }
390 } 390 }
391 lua_pushstring(L, fname); 391 lua_pushvalue(L, -2); /* move value to the top */
392 lua_pushvalue(L, -3); /* move value to the top */ 392 lua_setfield(L, -2, fname); /* set last field */
393 lua_rawset(L, -3); /* set last field */
394 lua_pop(L, 2); /* remove value and table */ 393 lua_pop(L, 2); /* remove value and table */
395 return NULL; 394 return NULL;
396} 395}