COMMUNITY

Source maps for lua?

I know that Haxe is able to generate source maps for javascript, but the “-debug” compiler option seems to do nothing when targeting lua.

Are source maps supported for lua? If not, is there any way to get mappings to the original source code in order to be able to write a haxe-lua debugger?

Sourcemaps for lua target are not implemented yet.

1 Like

I was looking into this. There’s something equivalent for moonscript, and apparently a lua debugger called mobdebug (https://github.com/pkulchenko/MobDebug) supports it. However, it’s not well documented.

It seems what MobDebug is doing is simply overriding the error message and converting the internal lua callstack printout to its own. I think we should be able to do that fairly easily, so stay tuned.

1 Like

Thanks! Happy to hear it’s being considered. In the meanwhile, I’ve succeeded in integrating this simple command line-based debugger and I am currently debugging the haxe generated lua script with it: https://github.com/slembcke/debugger.lua

It’s a simple command line wrapper for the built-in lua “debug” module. With haxe provided source maps for lua, it should be fairly easy to make it output haxe script information.

1 Like