gvvaughan / lyaml

LibYAML binding for Lua.
gvvaughan.github.io/lyaml
Other
209 stars 34 forks source link

Error 'attempt to call field 'emitter' (a nil value)' using LuaJIT #34

Closed DarkWiiPlayer closed 5 years ago

DarkWiiPlayer commented 5 years ago

Using LuaJIT on Linux Mint, I get the following error when I call lyaml.dump {{foo="bar"}}

/usr/local/share/lua/5.1/lyaml/init.lua:231: attempt to call field 'emitter' (a nil value)
stack traceback:
    /usr/local/share/lua/5.1/lyaml/init.lua:231: in function 'Dumper'
    /usr/local/share/lua/5.1/lyaml/init.lua:256: in function 'dump'
    stdin:1: in main chunk
    [C]: at 0x004044a0

And a very similar error with lyaml.load, except it's parser that's nil.

DarkWiiPlayer commented 5 years ago

After some more testing it seems this error only affects LuaJIT 2.0, but it works on 2.1.0-beta3


After more testing, the once installed rock works down to LuaJIT 2.0.0; I have yet to test recompiling it against these LuaJIT versions or PUC Lua 5.1, which might be the cause of the problem.

So far though, evidence is pointing towards this being a problem with my box, not necessarily the lyaml module.

DarkWiiPlayer commented 5 years ago

In the end I found the cause: lyaml seems incompatible with lua-yaml, which also has a module simply called yaml, so Lua loads that instead. So the error was indeed on my system, though it seems weird that a module lyaml would call a submodule yaml; maybe it'd be worth renaming that to avoid name clashes like this.