From afe4eba957dadf219ff4b4d2a3aa89b773f44fdd Mon Sep 17 00:00:00 2001 From: Alexander Gavrilov Date: Sun, 1 Apr 2012 16:43:40 +0400 Subject: 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. --- depends/lua/src/lauxlib.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'depends') 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 */ -- cgit v1.2.1