Hi all,
I'm having some issues calling Lua functions from Haskell. I have the
following in "Haskell2Lua.lua":
function hello ()
   return "hello world"
end

And my Haskell file "Haskell2Lua.hs" looks like this:
import qualified Scripting.Lua as
Lua

main =
do

    l <-
Lua.newstate

    Lua.openlibs
l

    succ <- Lua.loadfile l
"/Haskell2Lua.lua"

    print succ


    Lua.callproc l "hello"
""

    Lua.close l

When I compile and run this file I get:
0
Haskell2Lua: user error (attempt to call a nil value)

I have tried some variations on calling the function including:
Lua.callproc l "hello"
Lua.callfunc l "hello"
Lua.callfunc l "hello" ""

I know the Lua bridge is working because the following works:

Lua.callproc l "print" "Hello from Lua"

Any help is appreciated!
-deech
_______________________________________________
Haskell-Cafe mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to