summaryrefslogtreecommitdiff
path: root/plugins/MirLua/Modules/m_json/src/main.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/MirLua/Modules/m_json/src/main.cpp')
-rw-r--r--plugins/MirLua/Modules/m_json/src/main.cpp8
1 files changed, 3 insertions, 5 deletions
diff --git a/plugins/MirLua/Modules/m_json/src/main.cpp b/plugins/MirLua/Modules/m_json/src/main.cpp
index fe987d36f3..c26f350f63 100644
--- a/plugins/MirLua/Modules/m_json/src/main.cpp
+++ b/plugins/MirLua/Modules/m_json/src/main.cpp
@@ -17,11 +17,9 @@ static int lua_Encode(lua_State *L)
JSONNode *node = json_new(JSON_NODE);
lua_pushnil(L);
- while (lua_next(L, 1) != 0)
- {
- lua2json(L, *node);
- lua_pop(L, 1);
- }
+ lua_pushvalue(L, 1);
+ lua2json(L, *node);
+ lua_pop(L, 2);
JSON *mt = new (L) JSON(node);
luaL_setmetatable(L, MT_JSON);