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

Interesting.

I'd love to have type annotations in Lua.

But this doesn't compile to Lua, right?



Unfortunately not, it is the whole Compiler and VM. I'm not super familiar with embedding Luau only having messed around with it for a bit, but I highly doubt it'd be too difficult to drop in Luau over top an existing Lua implementation


Thanks!

I found Teal, which seems to Lua what TypeScript is to JavaScript


There's also a Typescript to Lua transpiler https://typescripttolua.github.io/

I've used it successfully with Love2d projects (albeit with some quirks)


Lol, that's great.

What are the quirks?


Mostly that Lua datatypes don’t always have great analogs in TS (particularly tables) and you have to be pretty cognizant of what’s going on under the hood.

All of these, too: https://typescripttolua.github.io/docs/caveats


I use Teal for Pico8 game development. It's great.


Interesting, what do they do about missing type info? Is there some repo of types for popular libraries?


There's the official teal-types[1] project that aims to fill that gap only for standard Lua. I've used the LÖVE types[2] in the past.

1: https://github.com/teal-language/teal-types/tree/master/type... 2: https://github.com/MikuAuahDark/love2d-tl


No idea, probably nothing.


No, Luau is a new programming language that's based on Lua.




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

Search: