News for hackers. Stuff that matters.
Re:You can now write React in Lua by imadj on Monday June 24, 2024 @03:38AM (#40773415)
Some background for anyone interested: The project is a fork of `roblox/react-lua` to basically open it up for community engagement and it uses Luau

Roblox's Luau: https://luau-lang.org/

> Luau is a fast, small, safe, gradually typed embeddable scripting language derived from Lua.

> Around 2006, Roblox started using Lua 5.1 as a scripting language for games. Over the years the runtime had to be tweaked to provide a safe, secure sandboxed environment; we gradually started accumulating small library changes and tweaks.

Re:You can now write React in Lua by k__ on Monday June 24, 2024 @04:05AM (#40773539)
Interesting.

I'd love to have type annotations in Lua.

But this doesn't compile to Lua, right?

Re:You can now write React in Lua by gsck on Monday June 24, 2024 @04:47AM (#40773762)
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
Re:You can now write React in Lua by k__ on Monday June 24, 2024 @05:35AM (#40774019)
Thanks!

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

Re:You can now write React in Lua by hombre_fatal on Monday June 24, 2024 @11:41AM (#40777388)
I use Teal for Pico8 game development. It's great.
Re:You can now write React in Lua by boredtofears on Monday June 24, 2024 @02:25PM (#40779206)
There's also a Typescript to Lua transpiler https://typescripttolua.github.io/

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

Re:You can now write React in Lua by k__ on Tuesday June 25, 2024 @12:18PM (#40790373)
Lol, that's great.

What are the quirks?

Re:You can now write React in Lua by boredtofears on Tuesday June 25, 2024 @12:32PM (#40790527)
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

Re:You can now write React in Lua by oblio on Monday June 24, 2024 @06:19PM (#40781637)
Interesting, what do they do about missing type info? Is there some repo of types for popular libraries?
Re:You can now write React in Lua by k__ on Tuesday June 25, 2024 @12:19PM (#40790377)
No idea, probably nothing.
Re:You can now write React in Lua by 0x6d on Tuesday June 25, 2024 @12:54PM (#40790790)
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

Re:You can now write React in Lua by MenhirMike on Monday June 24, 2024 @12:44PM (#40778205)
No, Luau is a new programming language that's based on Lua.
Re:You can now write React in Lua by TheRealPomax on Monday June 24, 2024 @11:10AM (#40776971)
So hang on. "We had to customize Lua, but didn't contribute all those changes back upstream"? Or "We tried to contribute those changes upstream but Lua didn't want to take them onboard"?
Re:You can now write React in Lua by samatman on Monday June 24, 2024 @11:13AM (#40777005)
PUC Lua uses a closed development model. They have a small team, and that team both decides what goes into the language, and writes the implementation themselves.

There are a great many implementations of Lua at this point, I'm aware of at least six. But Roblox upstreaming their semantic changes was never an option.

Re:You can now write React in Lua by CobrastanJorji on Monday June 24, 2024 @02:16PM (#40779117)
PUC's Lua is, however, open source (https://www.lua.org/license.html), even if they don't solicit contributions, and they do accept happily accept financial support. It doesn't look like they release new versions very frequently at all (the last release was in over a year ago). Still, it appears they do accept financial contributions, so it seems like Roblox, whose market cap is $22 billion and whose offerings are at present entirely dependent on Lua, should probably consider offering at least token support (https://www.lua.org/thanks.html).
Re:You can now write React in Lua by imachine1980_ on Monday June 24, 2024 @04:58PM (#40780684)
Why does the market cap allow you to decide about other people's projects? Lua is used in many places, and its users aren't all employees of Roblox. Lua is popular because it works in a way that sometimes breaks backward compatibility, making the language as easy and lean as it is. If there's a disagreement on how it should be used, just fork it like Roblox did.
Re:You can now write React in Lua by TheRealPomax on Monday June 24, 2024 @02:24PM (#40779193)
Of course it was: there is nothing preventing a company from contacting the dev team and going "we've one quite a bit of work, are you interested in getting any of that upstreamed". Getting changes upstreamed is in no way the exclusive domain of fully open source projects, it just requires reaching out.

Just because there's a closed development model doesn't automatically imply the devs team lives and breathes "not-invented-here"-ism and are no interested in discussing improvements that make a difference to actual people using Lua in (extremely) large real world products.

Re:You can now write React in Lua by samatman on Monday June 24, 2024 @04:50PM (#40780594)
It was not a general statement, but rather, a specific one.

> Lua is not "open developed". The development is done exclusively by the Lua team, at PUC-Rio. So, we do not need a SVN repository. Currently, we keep Lua with the good old RCS.

- Roberto Ierusalimschy

http://lua-users.org/lists/lua-l/2007-09/msg00476.html

Re:You can now write React in Lua by TheRealPomax on Monday June 24, 2024 @05:32PM (#40781063)
Yes, I know, that was my point too: it's closed development and so you can talk to the dev team to get changes worked into Lua itself. You don't get to just open a PR and start thigns that way, you have to talk to people. And going "well we didn't contact them" when you're the size of Roblox would be incredible.
Re:You can now write React in Lua by HaroldCindy on Monday June 24, 2024 @08:07PM (#40782662)
Any upstreaming was unlikely to ever be acceptable to the PUC-Rio folks.

PUC-Rio Lua uses C (with a tiny bit of C++ for stack unwinding on errors if folks don't want to use `longjmp()`,) Luau is strictly C++. Luau rewrites quite a lot of the core structures, and they aren't compatible. Further, Luau is a fork of PUC-Rio Lua _5.1_ (the current is 5.4 I think?) and intentionally picks and chooses features from later Lua versions. Even things like improvements to the core VM interpreter loop wouldn't be upstreamable, because Lua 5.2+ has a fundamentally different model to allow for yielding in metamethods. PUC-Rio would not accept changes other than fixes for critical bugs in Lua 5.1.

I like both PUC-Rio Lua and Luau, but a hard fork with no upstreaming was the only option here. The architectural differences of the VMs are so large now that it would amount to PUC-Rio adopting Luau. Supposing there is some tiny bit that PUC-Rio is interested in, they can cherry-pick it out of Luau, since they use the same license.

Re:You can now write React in Lua by drekipus on Monday June 24, 2024 @06:21PM (#40781663)
> The development is done exclusively by the Lua team, at PUC-Rio. So, we do not need a SVN repository.

If I had this as my message, and someone asked to ship changes, I would be more than mad.

just take the L dude.

Re:You can now write React in Lua by TheRealPomax on Tuesday June 25, 2024 @05:59PM (#40794158)
What a ridiculous thing to say. If you ran, or were part of, an academically run project, "you'd get mad" if a huge industry player went "hey we did some stuff with your project, some of it might be interesting to you, want to chat about potential upstreaming?"

really, dude?

Re:You can now write React in Lua by drekipus on Wednesday June 26, 2024 @08:22AM (#40799146)
Yes, because that is more burden to ensure that it still fits my purpose, the intended goals, and that whoever it is, is doing it properly.

Which would be the whole reason I would put such a statement there, in the first place.

What are you even trying to argue with now? That I'm not allowed to get angry in the hypothetical that I made up? Do you see why it's fruitless to continue arguing?

Or are you going to pick out some prior wording and analyse it further, because you just can't comprehend that corporations don't have best interests at heart, and some people prefer to just put things up and not deal with other people's improvements

Re:You can now write React in Lua by jhatemyjob on Monday June 24, 2024 @02:24PM (#40779200)
-
Re:You can now write React in Lua by jakedub4d2 on Monday June 24, 2024 @03:01PM (#40779493)
Wouldn't this let you run a front end on the edge with Nginx??? Sounds fun!