diff options
author | Albert Krewinkel <albert@zeitkraut.de> | 2017-12-10 21:43:57 +0100 |
---|---|---|
committer | Albert Krewinkel <albert@zeitkraut.de> | 2017-12-10 21:43:57 +0100 |
commit | 1cd785fe33231a15423dea7d26cb9a7d770a7ace (patch) | |
tree | d787915dc967385748042898445e0ff46df28566 /src/Text | |
parent | 544494d0e234e899a45f02b185cf5a448787f786 (diff) | |
download | pandoc-1cd785fe33231a15423dea7d26cb9a7d770a7ace.tar.gz |
Lua filters: fix package loading for Lua 5.1
The list of package searchers is named `package.loaders` in Lua 5.1 and
LuaJIT, and `package.searchers` in Lua 5.2 and later.
Diffstat (limited to 'src/Text')
-rw-r--r-- | src/Text/Pandoc/Lua/Packages.hs | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/Text/Pandoc/Lua/Packages.hs b/src/Text/Pandoc/Lua/Packages.hs index ede7beccd..b2dbff496 100644 --- a/src/Text/Pandoc/Lua/Packages.hs +++ b/src/Text/Pandoc/Lua/Packages.hs @@ -53,7 +53,10 @@ data LuaPackageParams = LuaPackageParams -- | Insert pandoc's package loader as the first loader, making it the default. installPandocPackageSearcher :: LuaPackageParams -> Lua () installPandocPackageSearcher luaPkgParams = do - Lua.getglobal' "package.searchers" + luaVersion <- Lua.getglobal "_VERSION" *> Lua.peek (-1) + if luaVersion == "Lua 5.1" + then Lua.getglobal' "package.loaders" + else Lua.getglobal' "package.searchers" shiftArray Lua.pushHaskellFunction (pandocPackageSearcher luaPkgParams) Lua.wrapHaskellFunction |