import qualified Scripting.Lua as L

main :: IO ()
main = do
  -- create a new Lua interpreter with libraries
  l <- L.newstate
  L.openlibs l
  -- load a Lua source code file
  0 <- L.loadfile l "test.lua"
  -- execute the loaded file
  0 <- L.pcall l 0 0 0
  -- call a function defined when the loaded file was executed
  r <- L.callfunc l "hello"
  -- print the result of the function call
  putStrLn r
  -- destroy the Lua interpreter
  L.close l
