From 5388ad475f85b162f4570bf1fbf410b620e5b553 Mon Sep 17 00:00:00 2001 From: Alexander Gavrilov Date: Sat, 20 Oct 2012 20:14:50 +0400 Subject: [PATCH] Fix a bug in lua wrapper caused by the recent pairs() addition. It inadvertently removed all functions like df.new from the df table. --- library/LuaWrapper.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/library/LuaWrapper.cpp b/library/LuaWrapper.cpp index 75e3b697c..1ce405c29 100644 --- a/library/LuaWrapper.cpp +++ b/library/LuaWrapper.cpp @@ -1641,10 +1641,13 @@ static int DoAttach(lua_State *state) freeze_table(state, true, "df"); - lua_swap(state); + // pairstable dftable dfmeta + + lua_pushvalue(state, -3); lua_pushcclosure(state, wtype_pairs, 1); lua_setfield(state, -2, "__pairs"); lua_pop(state, 1); + lua_remove(state, -2); } return 1;