3 ms·
Can this transpile type-annotated Luau code to just regular Lua code? I would like to add type checks to my Lua code but I dont want to run it in the Luau VM.
by VWWHFSfQ 5y ago
Can this transpile type-annotated Luau code to just regular Lua code? I would like to add type checks to my Lua code but I dont want to run it in the Luau VM. I want to run it in PUC-Rio Lua, and LuaJIT. Something like Haxe[1], but not an entirely different programming language.
[1] https://haxe.org/ https://haxe.org/
- spicybright 5y agoI highly doubt it. Most of the time with these forks they change/remove core language features instead of compiling down to plain lua.
- tfsh 5y agoIt's worth noting that Luau is backwards compatible with Lua 5.1*, so I see no technical reason why transpilation wouldn't be possible. * I'm tangentially aware of some RFCs to deprecate metatable related methods (setmetatable, getmetatable, rawset, etc), which may have an impact.
- buybackoff 5y agoThere is Teal language that has type annotations and could output plain Lua: https://github.com/teal-language/tl https://github.com/teal-language/tl
- VWWHFSfQ 5y agoooh neat
- implicit 5y agoThere is a transpiler in the source tree, but I expect it needs a polish pass. We haven't put it to use in quite some time. In particular, I am pretty sure that it won't do the right thing when it encounters the extra syntax we've added to Luau. So far, that's an if-else expression and a continue keyword. Transpiling those accurately will take a bit of work.
- japhib 5y agoDoubtful, but there is TypescriptToLua: https://typescripttolua.github.io/ https://typescripttolua.github.io/ Here's a whole list of languages that compile to Lua (many of them statically typed): https://github.com/hengestone/lua-languages https://github.com/hengestone/lua-languages