diff options
author | Albert Krewinkel <albert@zeitkraut.de> | 2017-04-11 23:31:55 +0200 |
---|---|---|
committer | Albert Krewinkel <albert@zeitkraut.de> | 2017-04-11 23:31:55 +0200 |
commit | 7e3705c1c4a7b63ce6818c1e3cb3496ff618ac0f (patch) | |
tree | 8975ed815111d7ae7c322bb146e736411825840d /src/Text/Pandoc/Lua.hs | |
parent | d4e5fe02b0adddbe82ed00c3aabe46b2915a1ed7 (diff) |
Lua filter: use custom StackValue Inline instance
Inline elements are no longer pushed and pulled via aeson's Value.
Diffstat (limited to 'src/Text/Pandoc/Lua.hs')
-rw-r--r-- | src/Text/Pandoc/Lua.hs | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/Text/Pandoc/Lua.hs b/src/Text/Pandoc/Lua.hs index a68810bd7..d7c54b6af 100644 --- a/src/Text/Pandoc/Lua.hs +++ b/src/Text/Pandoc/Lua.hs @@ -170,9 +170,11 @@ runLuaFilterFunction lua lf inline = do pushFilterFunction lua lf Lua.push lua inline Lua.call lua 1 1 - Just res <- Lua.peek lua (-1) - Lua.pop lua 1 - return res + mbres <- Lua.peek lua (-1) + case mbres of + Nothing -> error $ "Error while trying to get a filter's return " + ++ "value from lua stack." + Just res -> res <$ Lua.pop lua 1 -- | Push the filter function to the top of the stack. pushFilterFunction :: Lua.LuaState -> LuaFilterFunction a -> IO () |