{-# LANGUAGE LambdaCase #-}
{-# LANGUAGE OverloadedStrings #-}
module Text.Pandoc.Lua.Marshal.List
( module HsLua.List
, pushPandocList
) where
import HsLua
import HsLua.List
pushPandocList :: LuaError e => Pusher e a -> Pusher e [a]
pushPandocList :: forall e a. LuaError e => Pusher e a -> Pusher e [a]
pushPandocList Pusher e a
pushItem [a]
items = do
Pusher e a -> [a] -> LuaE e ()
forall e a. LuaError e => Pusher e a -> Pusher e [a]
pushList Pusher e a
pushItem [a]
items
Name -> LuaE e Type
forall e. Name -> LuaE e Type
getmetatable' Name
"List" LuaE e Type -> (Type -> LuaE e ()) -> LuaE e ()
forall a b. LuaE e a -> (a -> LuaE e b) -> LuaE e b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= \case
Type
TypeTable -> StackIndex -> LuaE e ()
forall e. StackIndex -> LuaE e ()
setmetatable (CInt -> StackIndex
nth CInt
2)
Type
_ -> String -> LuaE e ()
forall e a. LuaError e => String -> LuaE e a
failLua String
"List has not been initialized correctly."