diff options
-rw-r--r-- | lauxlib.c | 7 |
1 files changed, 3 insertions, 4 deletions
@@ -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 | } |