diff options
author | John MacFarlane <jgm@berkeley.edu> | 2017-09-26 10:05:56 -0700 |
---|---|---|
committer | John MacFarlane <jgm@berkeley.edu> | 2017-09-26 10:07:15 -0700 |
commit | 3fe4aad5a16545a92088510a00d2109a04fd25b8 (patch) | |
tree | 146703b52d656d08ce8946422ac082e30eb87b08 /src | |
parent | 2cdb8fe2e65aa13f91c9decd4e6cad97e87cc402 (diff) | |
download | pandoc-3fe4aad5a16545a92088510a00d2109a04fd25b8.tar.gz |
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')
-rw-r--r-- | src/Text/Pandoc/Lua.hs | 4 |
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 () |