summaryrefslogtreecommitdiff
path: root/pandoc-lua-engine/src/Text/Pandoc/Lua/Init.hs
diff options
context:
space:
mode:
authorAlbert Krewinkel <albert@zeitkraut.de>2023-03-15 20:49:49 +0100
committerAlbert Krewinkel <albert@zeitkraut.de>2023-03-15 20:57:45 +0100
commitb5b9edf5645277c11fd9d3a9300c74a7f08434f5 (patch)
treea37127f10bda99b6f47fefaf0e1c333fff0dce44 /pandoc-lua-engine/src/Text/Pandoc/Lua/Init.hs
parent369e7b52e81735695d206d8f23308f96d39e0986 (diff)
Lua: keep the Lua stack clean
A metatable used during initialization was not properly removed from the stack. Likewise, accessing the CommonState from Lua previously led to the pollution of the Lua stack with a left-over value.
Diffstat (limited to 'pandoc-lua-engine/src/Text/Pandoc/Lua/Init.hs')
-rw-r--r--pandoc-lua-engine/src/Text/Pandoc/Lua/Init.hs1
1 files changed, 1 insertions, 0 deletions
diff --git a/pandoc-lua-engine/src/Text/Pandoc/Lua/Init.hs b/pandoc-lua-engine/src/Text/Pandoc/Lua/Init.hs
index aa501fbaf..247b70add 100644
--- a/pandoc-lua-engine/src/Text/Pandoc/Lua/Init.hs
+++ b/pandoc-lua-engine/src/Text/Pandoc/Lua/Init.hs
@@ -188,6 +188,7 @@ initLuaState = do
initJsonMetatable :: PandocLua ()
initJsonMetatable = liftPandocLua $ do
newListMetatable HsLua.Aeson.jsonarray (pure ())
+ Lua.pop 1
-- | Evaluate a @'PandocLua'@ computation, running all contained Lua
-- operations.