11 ms·
Luau goes open-source
- spicybright 5y agoHeck yeah. I don't know what this fork changes, but I love how many game engines will take lua and expand it to fit their exact needs like this. Very few scripting languages make it as easy to do as lua. This is an interesting related project: https://moonscript.org/ https://moonscript.org/ It compiles down to lua, and really beefs everything up. Interface is super nice too. You just put `require "moonscript"` at the top of the file and you're done, now just write your code in moon script.
- xvilka 5y agoThere is also a Fennel[1] that builds a LISP on top of Lua. [1] https://fennel-lang.org/ https://fennel-lang.org/
- MaximumADHD 5y agoTo my understanding it’s not so much a fork of Lua as it is a complete rewrite in C++. They’ve created their own custom VM and everything. The closest version it has parity with is Lua 5.1.4, with a few compatible features from 5.2 and 5.3 backported.
- spicybright 5y agoWow, now that's even more impressive. Makes me wonder if there's anything useful to "upstream" to vanilla lua here, or if the VM deviated too far.
- kzrdude 5y agoPUC-Rio's Lua doesn't take contributions anyway, right? It's open source but it's not an open project. Similar to.. uh.. nethack, at least how it used to be :) https://www.lua.org/community.html https://www.lua.org/community.html
- Raymonf 5y agoThe VM still has a lot of Lua 5.1 code. It's definitely a fork.
- jwatte 5y agoEverybody's focusing on the type stuff, which is nice -- but luau also just performance better than Lua in a bunch of cases. Arseny (from Roblox) has tweeted a bit about it. It's interesting to follow!
- VWWHFSfQ 5y agoCan 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 ago
- sizediterable 5y agoFrom https://luau-lang.org/typecheck https://luau-lang.org/typecheck > Luau’s type system is structural by default I think that makes it the second (production-ready) language to have a primarily-structural type system, after TypeScript/Flow(/and Closure to some extent) for JS. I wonder if it will follow in their impressive footsteps or if it will tread new territory. One of the things that Flow gets right that TypeScript doesn't yet support is switching to nominal type-checking between class instances. In TypeScript you can assign an instance of one class to an instance of another as long as they have compatible fields. Compare: Flow: https://bit.ly/3jZx4rB https://bit.ly/3jZx4rB TS: https://tsplay.dev/mZaL1N https://tsplay.dev/mZaL1N TypeScript doesn't have any understanding of prototypes or prototypal inheritance, which is a big gap considering that it's a fundamental aspect of JS. I'm really hoping Luau will come to do the right thing with tables and prototypes. Perhaps it already does, but unfortunately there doesn't seem to be a Luau playground to try in the browser.
- bajsejohannes 5y agoPony, amusingly, has both structural and nominal typing. https://tutorial.ponylang.io/types/traits-and-interfaces.html https://tutorial.ponylang.io/types/traits-and-interfaces.htm...
- Someone 5y agoSo has COBOL, sort-of. A regular MOVE is sort-of structural. It moves field i of the source to field i of the destination. Source and destination need not be of the same type, though. MOVE CORRESPONDING is nominal. It moves field Foo of the source to field Foo of the destination (leaving fields that do not have corresponding items alone) In both cases, data may be converted, for example from alphabetic to alphanumeric.
- deleted 5y ago[deleted]
- dgb23 5y agoWhat about Go and OCaml? And I'm sure there are others.
- junon 5y agoIf any of the Luau devs are watching this, please flesh out the metamethods. I'd switch almost everything to Luau if they were improved. They're the biggest PITA right now as designed in PUC-Rio, and I see that while you've improved upon __eq, other metamethods are still lacking. In PUC-Rio, boolean equality operators FORCE a boolean result, regardless of what you return. Ideally they would allow returning any result type, which then can be coerced to boolean later (e.g. by an `if` statement), just like the arithmetic operators do. Further, `__neq`, `__ge` and `__gt` do not exist. They should. The lack of a proper metamethod design means that binding to e.g. Kiwi[0] is impossible without some incredibly fugly hacks. It has been a long-standing annoyance with Lua in an otherwise beautiful little scripting language (that I use frequently). This looks quite nice - lots of attempts in this space but nothing that attempts to match Lua to this degree. [0] https://github.com/nucleic/kiwi https://github.com/nucleic/kiwi
- deleted 5y ago[deleted]
- deleted 5y ago[deleted]
- junon 5y agoActually went ahead and wrote an RFC for this: https://github.com/Roblox/luau/pull/109 https://github.com/Roblox/luau/pull/109
- adontz 5y ago>> Further, while >= and > can both be reversed to <= and < (and thus adding them in this RFC might be considered excessive or unnecessary) False. You need all operators because for database NULL-alike logic you cannot infer results from one half of operators. NULL < NULL == false NULL > NULL == false
- pansa2 5y agoCan’t you rewrite the second of those so it becomes the first, hence rewriting `>` into `<`?
- mid-kid 5y agoI'm mostly wondering, what does this have over regular Lua, especially now with 5.4?
- deleted 5y ago[deleted]
- plorkyeran 5y agoType annotations are the main benefit. It's also much faster than Lua 5.1, but I don't know how it compares to 5.4.
- jay_kyburz 5y agoI really miss compound assignments and a continue statement. The if then else expressions look cool too. Would love to see these in the LuaJIT but I think its considered "done"
- kzrdude 5y agoMike Pall has added two sponsored projects in 2021 http://luajit.org/sponsors.html http://luajit.org/sponsors.html I sure hope he's the world's best paid Lua contractor
- maxhou 5y agoimplementation of continue from one luajit fork: https://github.com/zewt/LuaJIT/commit/c0e38bacba15d0259c3b77843b8e1fa6e5312726 https://github.com/zewt/LuaJIT/commit/c0e38bacba15d0259c3b77...
- ketralnis 5y agoI can tell you from my own experience that luajit, which also targets 5.1 compatibility, is _significantly_ faster than Lua proper. In using it I've never missed 5.2+ features. So I imagine luau has the same thing going for it.
- deleted 5y ago
- asb 5y agoThe compatibility page (https://luau-lang.org/compatibility https://luau-lang.org/compatibility) mentions a "pending GC rework". Does anyone know anything more about this? I can recommend reading the performance page, it's a an engaging summary of the various tricks/optimisations that have been implemented https://luau-lang.org/performance https://luau-lang.org/performance
- Rochus 5y ago> If you wear a grass skirt and lei, you will most likely fit in at a luau. https://www.vocabulary.com/dictionary/luau https://www.vocabulary.com/dictionary/luau, https://en.wikipedia.org/wiki/L%C5%AB%CA%BBau https://en.wikipedia.org/wiki/L%C5%AB%CA%BBau
- allknowingfrog 5y agoThank you for this. I kept trying to pronounce this as some combination of "lua" and a "u" sound, which made no kind of sense. I have apparently never seen the word "luau" out of context.
- losvedir 5y agoWho needs yet another progra.... oh, it's a gradually typed fork of Lua in production use at Roblox eyes slowly widen.
- deleted 5y ago[deleted]
- vanderZwan 5y ago> using a combination of techniques pioneered by LuaJIT and custom optimizations that are able to improve performance by taking control over the entire stack (language, compiler, interpreter, virtual machine), we’re able to get close to LuaJIT interpreter performance while using C as an implementation language. At first I was a bit surprised by this, given that they have much better type information, but they forget to mention until further on that Luau doesn't use JIT/AOT optimizations (yet). Still, it's as good an excuse as any to bring out this quote again: “LuaJIT is much faster than all of the other languages, including Wren, because Mike Pall is a robot from the future” - Robert Nystrom
- arthurcolle 5y agoPeople seem to say this (or similar remarks) when talking about Lua but even more specifically, LuaJIT in particular but it seems like Lua is already a pretty niche language so am I just missing something? Like you can embed Lua in other languages but why use Lua instead of something like mruby for all the warm fuzzy feelings you get when writing Ruby? Just curious, appreciate any context you can provide!
- stravant 5y agoThe advantage that Lua has is that it has about the simplest possible binding interface you can imagine for a Language. There's no manifests, no class definitions, no anything really. It's as simple as calling lua_newstate to create a state, calling lua_pushcfunction to register some functions that expose your desired engine functionality, and calling lua_loadstring with a script to run. That means you can use Lua in your engine for something as simple as a CLI interface that just exposes a couple dozen functions, and it's still worth it. Where with any other scripting language you'd have to be doing a lot more with it to make the setup cost worthwhile. Having LuaJIT available if you end up wanting to do more with it later is the icing on the cake.
- pansa2 5y ago> why use Lua instead of something like mruby The main reason is momentum - Lua has been the de-facto standard embeddable language for at least 15 years. For example, it's used in World of Warcraft which was released in 2004. Another reason is the quality of the implementation - Lua has very few bugs [0], whereas Shopify tried to embed mruby and had to give up because it had too many security holes [1]. Finally, Lua is a complete language in itself, with a guidebook, reference manual and so on. Mruby (and MicroPython) are less well-known. Plenty of people know Ruby or Python, but if you use the smaller implementations, you never know when your code might hit a language feature that they don't support. [0] https://www.lua.org/bugs.html https://www.lua.org/bugs.html [1] https://brandur.org/fragments/shopify-mruby https://brandur.org/fragments/shopify-mruby
- ttymck 5y agoThe more I read about Lua, the more I like it. What's the recommended learning material for beginners?
- VWWHFSfQ 5y agoProgramming in Lua[1] is the K&R for Lua. [1] https://www.lua.org/pil/ https://www.lua.org/pil/
- disjukr 5y agoThere is a language [1] that type check by adding comments instead of fixing Lua (like Flow comment syntax [2]), I wonder if the Luau team has considered this language. [1] https://github.com/devcat-studio/kailua https://github.com/devcat-studio/kailua [2] https://flow.org/blog/2015/02/20/Flow-Comments/ https://flow.org/blog/2015/02/20/Flow-Comments/
- nerdponx 5y agoThere is also Teal/Tl https://github.com/teal-language/tl https://github.com/teal-language/tl
- cutler 5y agoWhat is it with grafting type systems onto dynamic, interpreted languages? Can't we just leave them alone? There are plenty of statically-typed languages if types are required.
- SaigeTheGirl 5y agothe only statically typed language that’s usable with roblox is roblox-ts pretty much, and that’s just an unofficial project that compiled ts to luau. there’s nothing wrong with adding types to luau.
- hansihe 5y agoBecause as codebases in dynamic languages grow and age the developers start seeing the advantages having a static type system to lean on would give them.
- jrochkind1 5y agoDoes nobody else find this confusing naming? How do you pronounce that, and does it sound like lua? Will subsequent derived languages be called luaua and luauau?
- deleted 5y ago[deleted]
- incaseofire 5y agoin Lua the emphasys is in the 'u', in Luau its in 'a'
- culi 5y agoThis is helpful but somehow also makes it worse
- mkl 5y agoNot according to their own front page: "Luau (lowercase u, /ˈlu.aʊ/)". It would also be very unlikely, because it would make it different from the usual pronunciation of the word "luau" [1], which it seems to be making a pun with. [1] https://en.wiktionary.org/wiki/luau https://en.wiktionary.org/wiki/luau
- Rendello 5y agoLoo-ow or /ˈlu.aʊ/. [1] Assuming it's the same as "luau", which is a traditional Hawaiian feast, or –more frequently– a catch-all term for Hawaii-themed parties. [2] 1. https://en.wiktionary.org/wiki/luau#Pronunciation https://en.wiktionary.org/wiki/luau#Pronunciation 2. https://en.wikipedia.org/wiki/L%C5%AB%CA%BBau https://en.wikipedia.org/wiki/L%C5%AB%CA%BBau
- tytrdev 5y agoCan't wait to see if Fennel can support this =)
- Yuioup 5y agoI wonder if this fork will be backported to Lua, the extra features like strong typing maybe activated with a compiler switch or something.
- OneTimePetes 5y agoThe first thing you do is to play - and one day you play on a computer. And here it is you learn it all. How to operate a OS and what to expect of it. How to install a program. And how to program. Which means in 15 years, lua like syntax will push aside java-script, because this generation learned it in another way. Might aswell embrace it ahead of time. Learned Future Preference dominance is gaming market dominance.