From 3fe4aad5a16545a92088510a00d2109a04fd25b8 Mon Sep 17 00:00:00 2001 From: John MacFarlane Date: Tue, 26 Sep 2017 10:05:56 -0700 Subject: Lua: set "arg" instead of "PandocParameters". This is standard for lua scripts, and I see no reason to depart from the standard here. Also, "arg" is now pushed onto the stack before the script is loaded. Previously it was not, and thus "PandocParameters" was not available at the top level. --- src/Text/Pandoc/Lua.hs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/Text') diff --git a/src/Text/Pandoc/Lua.hs b/src/Text/Pandoc/Lua.hs index 477076191..2860b84df 100644 --- a/src/Text/Pandoc/Lua.hs +++ b/src/Text/Pandoc/Lua.hs @@ -57,6 +57,8 @@ runLuaFilter datadir filterPath args pd = liftIO . Lua.runLua $ do -- store module in global "pandoc" pushPandocModule datadir Lua.setglobal "pandoc" + push args + Lua.setglobal "arg" top <- Lua.gettop stat <- Lua.dofile filterPath if stat /= OK @@ -68,8 +70,6 @@ runLuaFilter datadir filterPath args pd = liftIO . Lua.runLua $ do -- Use the implicitly defined global filter if nothing was returned when (newtop - top < 1) pushGlobalFilter luaFilters <- peek (-1) - push args - Lua.setglobal "PandocParameters" runAll luaFilters pd pushGlobalFilter :: Lua () -- cgit v1.2.3