summaryrefslogtreecommitdiff
path: root/src/Text/Pandoc/Lua.hs
diff options
context:
space:
mode:
authorJohn MacFarlane <jgm@berkeley.edu>2017-09-26 10:05:56 -0700
committerJohn MacFarlane <jgm@berkeley.edu>2017-09-26 10:07:15 -0700
commit3fe4aad5a16545a92088510a00d2109a04fd25b8 (patch)
tree146703b52d656d08ce8946422ac082e30eb87b08 /src/Text/Pandoc/Lua.hs
parent2cdb8fe2e65aa13f91c9decd4e6cad97e87cc402 (diff)
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.
Diffstat (limited to 'src/Text/Pandoc/Lua.hs')
-rw-r--r--src/Text/Pandoc/Lua.hs4
1 files changed, 2 insertions, 2 deletions
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 ()