aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlbert Krewinkel <albert@zeitkraut.de>2019-08-15 22:53:02 +0200
committerAlbert Krewinkel <albert@zeitkraut.de>2019-08-16 20:52:15 +0200
commit1f9384542e695ae1a6fcbf9b7ee197a7e689a12a (patch)
tree4e34da38ab96397471a1c72a819e373c87f572de
parent2712d3e869b8a371e1fa261f05fbd5d76561e3a0 (diff)
downloadpandoc-1f9384542e695ae1a6fcbf9b7ee197a7e689a12a.tar.gz
Lua: improve function documentations
-rw-r--r--src/Text/Pandoc/Lua/Filter.hs5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/Text/Pandoc/Lua/Filter.hs b/src/Text/Pandoc/Lua/Filter.hs
index 9efc2b9ae..9416bf41f 100644
--- a/src/Text/Pandoc/Lua/Filter.hs
+++ b/src/Text/Pandoc/Lua/Filter.hs
@@ -93,7 +93,10 @@ pushFilterFunction :: LuaFilterFunction -> Lua ()
pushFilterFunction (LuaFilterFunction fnRef) =
Lua.getref Lua.registryindex fnRef
-
+-- | Fetch either a list of elements from the stack. If there is a single
+-- element instead of a list, fetch that element as a singleton list. If the top
+-- of the stack is nil, return the default element that was passed to this
+-- function. If none of these apply, raise an error.
elementOrList :: Peekable a => a -> Lua [a]
elementOrList x = do
let topOfStack = Lua.stackTop