Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

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/



There is Teal language that has type annotations and could output plain Lua: https://github.com/teal-language/tl


ooh neat


There 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.


Doubtful, but there is TypescriptToLua: 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


I highly doubt it. Most of the time with these forks they change/remove core language features instead of compiling down to plain lua.


It'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.




Consider applying for YC's Winter 2027 batch! Applications are open till November 2.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: