3 ms·
Interesting. I'd love to have type annotations in Lua. But this doesn't compile to Lua, right?
by k__ 2y ago
Interesting.
I'd love to have type annotations in Lua.
But this doesn't compile to Lua, right?
- gsck 2y agoUnfortunately 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
- k__ 2y agoThanks! I found Teal, which seems to Lua what TypeScript is to JavaScript
- hombre_fatal 2y agoI use Teal for Pico8 game development. It's great.
- boredtofears 2y agoThere's also a Typescript to Lua transpiler https://typescripttolua.github.io/ https://typescripttolua.github.io/ I've used it successfully with Love2d projects (albeit with some quirks)
- k__ 2y agoLol, that's great. What are the quirks?
- boredtofears 2y agoMostly 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 https://typescripttolua.github.io/docs/caveats
- oblio 2y agoInteresting, what do they do about missing type info? Is there some repo of types for popular libraries?
- k__ 2y agoNo idea, probably nothing.
- 0x6d 2y agoThere'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/types https://github.com/teal-language/teal-types/tree/master/type... 2: https://github.com/MikuAuahDark/love2d-tl https://github.com/MikuAuahDark/love2d-tl
- MenhirMike 2y agoNo, Luau is a new programming language that's based on Lua.