summaryrefslogtreecommitdiff
path: root/depends/lua
diff options
context:
space:
mode:
authorAlexander Gavrilov2012-04-01 16:43:40 +0400
committerAlexander Gavrilov2012-04-01 16:43:40 +0400
commitafe4eba957dadf219ff4b4d2a3aa89b773f44fdd (patch)
tree62a5df09f82e5cf8dc9843525710a2399bb8e3f5 /depends/lua
parenta9a6fbd8b597203083eb30e408d3982b01e611b8 (diff)
downloaddfhack-afe4eba957dadf219ff4b4d2a3aa89b773f44fdd.tar.gz
dfhack-afe4eba957dadf219ff4b4d2a3aa89b773f44fdd.tar.bz2
dfhack-afe4eba957dadf219ff4b4d2a3aa89b773f44fdd.tar.xz
Improve performance of the persistent data api, and wrap it for lua.
Use an stl table for string keys to avoid linear cost of lookup. This uncovered a bug in the new luaL_getsubtable function.
Diffstat (limited to 'depends/lua')
-rw-r--r--depends/lua/src/lauxlib.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/depends/lua/src/lauxlib.c b/depends/lua/src/lauxlib.c
index 0aa80fd9..c1b715f3 100644
--- a/depends/lua/src/lauxlib.c
+++ b/depends/lua/src/lauxlib.c
@@ -863,8 +863,8 @@ LUALIB_API int luaL_getsubtable (lua_State *L, int idx, const char *fname) {
lua_getfield(L, idx, fname);
if (lua_istable(L, -1)) return 1; /* table already there */
else {
- idx = lua_absindex(L, idx);
lua_pop(L, 1); /* remove previous result */
+ idx = lua_absindex(L, idx);
lua_newtable(L);
lua_pushvalue(L, -1); /* copy to be left at top */
lua_setfield(L, idx, fname); /* assign new table to field */