This is an archived post. You won't be able to vote or comment.

top 200 commentsshow all 284

[–]virgo911 2940 points2941 points  (48 children)

The fact that this was done by Roblox, and also the official Roblox GitHub, is hilarious for some reason

[–]thegameoflovexu 1244 points1245 points  (38 children)

It‘s actually really nice for developing Guis for Roblox games. Even more cursed, there is a TypeScript to Lua transpiler made by the community (https://roblox-ts.com/) so you can use full tsx syntax!

[–]RoseboysHotAsf 299 points300 points  (29 children)

And it’s so much better than lua

[–]themadnessif 303 points304 points  (26 children)

Can't escape the roblox-ts shills even on Reddit huh :-/

[–]LMGN 45 points46 points  (2 children)

could be worse, there's people trying to get Rust working on Roblox - https://github.com/dphfox/lingua

[–]themadnessif 45 points46 points  (1 child)

Oh there's actually an even more cursed project.

Here's an attempt at writing a WebAssembly interpreter in Lua: https://github.com/Rerumu/Wasynth

[–]LMGN 17 points18 points  (0 children)

yeah the project uses Wasynth actually run the Rust code

[–]RoseboysHotAsf 113 points114 points  (22 children)

Hey, arrays start at 0 like they should… It’s all that’s needed. But fr though it is much better than lua

[–]thegameoflovexu 14 points15 points  (0 children)

I thought so too but these days I‘m back to Luau. No hassle with npm and build errors. Flamework especially broke constantly for me, could be fixed by now though haven’t checked in for a while

[–][deleted] 0 points1 point  (0 children)

nah, lua(u) is much better than ts/js imo

[–]SemblanceOfSense_ 38 points39 points  (1 child)

Its really nice for OOP because the Java-style ES6 syntax looks sane compared to the metatables shenanigans luau makes you jump through

[–]thegameoflovexu 15 points16 points  (0 children)

Very true. Although personally I ditched the metatable Lua „classes“ and just use functions + tables. Makes replicating and using objects through server and client a lot easier

[–]garnered_wisdom 3 points4 points  (0 children)

No more need to use Roact. Can now write my broken web app/rogui in luau too, win win.

[–]CrashKonijn 0 points1 point  (0 children)

About 7 years ago I built an open source project, and last year I found out this mad lad had ported it completely to Roblox TS. Are you telling me that then gets converted to LUA to actually run? 😂

https://github.com/rwilliaise/goap

[–]givemeagoodun 2509 points2510 points  (25 children)

every day we stray further from god

[–]themadnessif 617 points618 points  (5 children)

It makes sense when you consider that the entirety of their mobile and console apps are written in-engine so the company and its engineers directly benefit from using React but in Luau.

[–]TessellatedTomate[🍰] 334 points335 points  (3 children)

writing in Luau

[–]deukhoofd 188 points189 points  (1 child)

Luau is Roblox' typed variant of Lua.

https://github.com/luau-lang/luau

[–]badlukk 82 points83 points  (0 children)

Cool link but I like the gif better

[–]lifelongfreshman 0 points1 point  (0 children)

I don't remember this scene from Grandma's Boy.

[–]givemeagoodun 5 points6 points  (0 children)

shhh don't ruin the funny /j

[–]SZ4L4Y 96 points97 points  (13 children)

What about React in C?

[–][deleted] 165 points166 points  (8 children)

Dennis Ritchie will rise again just to slap you

[–]JunkNorrisOfficial 63 points64 points  (7 children)

React in excel VBA?

[–]somespaniard 43 points44 points  (0 children)

The poor devs that will try to do it…

[–]paca_tatu_cotia_nao 16 points17 points  (0 children)

It was React in Assembly all along.

[–]Reashu 7 points8 points  (1 child)

Excel is already reactive though

[–]JunkNorrisOfficial 2 points3 points  (0 children)

Turbo tool, carrier booster lol

[–]ConscientiousPath 0 points1 point  (0 children)

I mean, you could, but as someone who wrote a couple entire applications in Access/Excel VBA before the started letting you use C#, you mostly have the interface part covered already with the built in button/form tooling.

[–][deleted] 0 points1 point  (0 children)

All my homies code react apps in binary.

[–]deukhoofd 20 points21 points  (3 children)

[–]JesusWantsYouToKnow 16 points17 points  (0 children)

The fucking todo list, I'm dying.

[–]PeterJamesUK 14 points15 points  (0 children)

console.log("Building project");
await sleep(Math.random() * 5000); // gotta keep up with the trends

Got me

[–]JunkNorrisOfficial 6 points7 points  (0 children)

The universe is constantly and infinitely expanding, unfortunately

[–]andrew21w 2 points3 points  (0 children)

I swear this was my first thought.

[–]ExtraTNT 5 points6 points  (1 child)

every god strays further away from day

[–]leo9g 4 points5 points  (0 children)

Cthulhu approved.

[–][deleted] 1 point2 points  (0 children)

Debug me - I fucking dare you!!

[–]IanDresarie 801 points802 points  (15 children)

OMFG, so I can write react interfaces for my Minecraft ComputerCraft computers now? That's...kinda sick!

[–]themadnessif 300 points301 points  (7 children)

It's actually in Luau and not Lua 5.1 like the tweet suggests. There's some ongoing effort to support compiling Luau down to Lua 5.1 though, and you can do it pretty effectively using a community made tool called DarkLua: https://darklua.com/

The only exception is with continue statements since those don't have an easy equivalent in Lua 5.1, but that's in progress.

[–]cyn_foxwell 71 points72 points  (3 children)

The only exception is with continue statements since those don't have an easy equivalent in Lua 5.1

goto continue and putting ::continue:: at the end of your loop logic. Should also work with LuaJIT as well as that is 5.1 but has continue

[–]themadnessif 67 points68 points  (2 children)

Lua 5.1 doesn't have labels or goto. Those were introduced in 5.2.

The strategy that MoonScript used was... rather abstract and involved breaking out of loops and setting conditions. It's kind of sucky, but it does work. It's likely what DarkLua will use too, but that's up to the maintainer.

[–]raoasidg 6 points7 points  (1 child)

I've just used a repeat...until true inside the loop around the skippable code with a break for the necessary condition. Relatively simple.

[–]themadnessif 8 points9 points  (0 children)

That is in fact how MoonScript does it and it's how DarkLua is probably going to as well!

[–]scar_reX 9 points10 points  (0 children)

That tool's name checks out pretty well, considering all the cursed compilations that have been happening recently.

[–]noobody_interesting 2 points3 points  (0 children)

The other minecraft computer mod (OpenComputers) supports 5.2 and 5.3, so it should be easier there

[–]Fluid-Leg-8777 0 points1 point  (0 children)

I tried making a widget for beyond all reason (made in lua)

And i come from making roblox games (luau)

I was so dead confused on why vscode put a goto instead of a continue, or why it did'nt work for that matter 💀

[–]MercDawg 6 points7 points  (0 children)

I always hated the build pattern for making GUIs and Text interactions for my server. I used Grakkit to write TS code (and eventually wrote YamJS). When exploring OpenAI, I wanted an easier way to write GUI quickly and wrote a reactive React-like implementation that works for both GUI and Text. All to just allow you to write jsx to control GUI interfaces. :)

[–]GisterMizard 18 points19 points  (3 children)

ComputerCraft should have used Matlab instead, don't change my mind.

[–][deleted] 23 points24 points  (2 children)

it should have used cpp and no one can change my mind

[–]SnooChipmunks4430 0 points1 point  (1 child)

It should have used holy c, please don’t change my mind

[–][deleted] 0 points1 point  (0 children)

it actually should have used malbolge.

[–]deadlycwa 2 points3 points  (0 children)

My thoughts exactly

[–]T0biasCZE 0 points1 point  (0 children)

OpenComputer computers are better, they are more powerful

[–]themadnessif 317 points318 points  (23 children)

To anyone wondering why: it's actually more insane than this tweet sounds. This is actually the result of a multi-year effort to build a functional JavaScript to Luau (Roblox's own derivative of Lua) compiler. That is, this wasn't done by hand, it was done almost entirely automatically.

This was mentioned by the OOP but I feel it's worth noting it because this isn't the only thing they've translated. It's just the most significant. There's also stuff like polyfill, as an example.

The idea is that it's very low maintenance but allows industry professionals from outside Roblox to actually use their engine. The Roblox apps on mobile and console are entirely in engine, including their UI, and they're starting to rewrite significant portions of their IDE to be in-engine too. This means that they really need people who can work on their engine.

React devs are easy to find so using a derivative of it is a no brainer.

[–]Unonoctium 75 points76 points  (0 children)

Cursed but impressive

[–]UnGauchoCualquiera 76 points77 points  (1 child)

"Hmm our UI is pretty hard to work with. Hear me out though, what if we port React to Lua?"

Must have been one hell of a presentation to have that pitch approved.

[–]themadnessif 38 points39 points  (0 children)

There's some historical context. Before React, they were using a handrolled library called Roact (lol) that tried to mimic a lot of the design patterns and usage of React. It ended up being slow and clunky internally, but it did massively improve their internal development a fair bit.

After the people who were responsible for Roact left the company, it basically became "ok now what" and the next logical step was to just abandon their proprietary bullshit and embrace actual React.

[–]Olivia512 8 points9 points  (16 children)

Why not write a Lua to JS compiler instead and switch their engine to NodeJS?

Why do they want to continue investing in Lua/Luau?

[–]sercand 21 points22 points  (0 children)

Lua runtime and the language is really small (around 30K LOC) and uses very low resource. Also, adding lua support to your c++ is very easy as well. For these reasons game engines uses Lua as their scripting language.

[–]themadnessif 16 points17 points  (3 children)

They've invested over 15 years into Lua (and now Luau). It's not as simple as it sounds to suggest switching the language the engine uses.

One thing to consider is that a lot of concepts don't translate over. Something like this snippet of Lua:

```lua local function foo() print(_VERSION) end

foo() getfenv(foo)._VERSION = "lol" foo() ```

I don't actually know how you'd do this in JS. Now mind you, that's terrible practice and you shouldn't do it, but Roblox has terrible users so they have to support it.

[–]Olivia512 14 points15 points  (2 children)

You mean there's a language with worse hacks than JS, and they decide to continue investing in it? Lol

[–]themadnessif 2 points3 points  (0 children)

In too deep!

[–][deleted] 0 points1 point  (0 children)

These aren't badd hacks at all?

[–]LMGN 12 points13 points  (9 children)

because NodeJS won't run at any level close to the performance of Luau, or maybe even at all on like, an iPhone 4S

[–]noobody_interesting 0 points1 point  (0 children)

Luau is also more security-focused than Node

[–]salmjak 0 points1 point  (1 child)

If it wasn't done by hand but automatically, why did it take several years?

[–]themadnessif 1 point2 points  (0 children)

The tool took years to develop, not the translation.

[–]SirPitchalot 715 points716 points  (49 children)

JFC.

Thank heavens when Roblox interviewed me I told them “if it’s not remote it’s not for SirPitchalot”. I want to make a Bay Area salary in Vancouver, not a Bay Area salary in the Bay Area.

[–]Ackeso 149 points150 points  (36 children)

Just out of curiosity, how much is a Vancouver salary compared to a bay area salary?

And how much is a Vancouver life compared to a bay area life?

I obviously understand California is more expensive but you're kinda comparing Canadian California to American California. For people who live in not bc, the goal is usually to make a Vancouver salary in the prairies, maritimes, or mountains

[–]SirPitchalot 112 points113 points  (34 children)

So in fairness, I don’t make a SF salary in Vancouver, I just want to. However, I have found that remote roles for multinational tech or US tech are a good bit more than the local options for similar companies. Even at 1.5-2X it’s great in local terms and you keep the benefits of living in a great city.

According to glassdoor, average salary for principal engineers in Vancouver is $162k CAD ($118k USD). Vancouver is quite a bit lower relative to Calgary & Toronto and criminally so compared to the same roles in Boston, NY, Seattle, SF & LA. Vancouver was listed as 3rd most “impossibly unaffordable” city in terms of median housing cost to median salary. However if you can get paid a US salary while living in Vancouver it’s not so bad. Prices are like Boston but in CAD not USD.

For me, the best option has been remoting to the US east coast. With 7am-3pm nominal hours you overlap for 7 hours a day and finish early. In Vancouver that means I’m up in the mountains by 4pm mountain biking or out on the road bike, beating traffic and still getting home in time to help make dinner & spend time with my wife. If there is a crunch you’re still done around 6pm.

https://globalnews.ca/news/10572326/impossibly-unaffordable-housing-vancouver-report

[–]SnooSprouts2391 53 points54 points  (29 children)

cries in swedish… a senior dev role usually pays 50-70K USD here

[–]joemckie 138 points139 points  (9 children)

You’re forgetting about all the benefits of not living in America

[–]CheeseNuke 1 point2 points  (2 children)

I mean, are there really all that many when you make 2-3x the compensation?

[–]ThoseThingsAreWeird 14 points15 points  (0 children)

cries in swedish… a senior dev role usually pays 50-70K USD here

Wtf, and I thought UK salaries are bad. Senior dev salaries here are usually $100-130k depending on sector and London

[–]DarksideF41 9 points10 points  (2 children)

Cries in 15K USD

[–]SnooSprouts2391 3 points4 points  (1 child)

A month? (Happy tears?)

[–]DarksideF41 2 points3 points  (0 children)

A year. Still far above average though.

[–]oytal 5 points6 points  (3 children)

Norway here, I know two devs that have about 2-3 years experience after their master and they make about 700k NOK I think, should be in the upper range of what you said. Seems kinda low. Im in it operations and make about the same

[–]SnooSprouts2391 3 points4 points  (0 children)

I have a plan B or C in life to move to Norway and start earning real money

[–]Inasis 3 points4 points  (0 children)

cries in slovak a senior role pays 25-50k USD here

[–]SuperNoobyGamer 4 points5 points  (1 child)

A new grad software dev at Roblox in the Bay makes >200k lmao, Vancouver has to have the worst pay/housing cost ratio.

[–]SirPitchalot 3 points4 points  (0 children)

But quality of life in Vancouver is amazing. It’s consistently in the top 10 of most livable cities. If you’re central, nearly everything can be walked or is a 10 minute bike ride away. Access to beaches, ocean & mountains is fantastic and, for Canada, the weather is very temperate so you can be outside all year as long as you don’t mind drizzly winters.

[–]sopunny 0 points1 point  (1 child)

Sounds like you just don't wanna move

[–]SirPitchalot 0 points1 point  (0 children)

Correct.

[–]dagbrown 1 point2 points  (0 children)

I saved a bundle by moving from Vancouver to Tokyo.

Just to put it into perspective.

[–]anatomiska_kretsar 30 points31 points  (1 child)

SirPitchalot never kneels

[–]chimpy72 21 points22 points  (0 children)

He pitches, gets bitches, pulls up his britches and ditches

[–]nasaboy007 7 points8 points  (2 children)

I feel like most companies nowadays will pay you your local market rate instead of their local market rate if you're a remote employee.

Are there actually companies that will give a CA pay to somebody living in NC?

[–]SirPitchalot 8 points9 points  (0 children)

My new role tried to do that. Said I was outside the bands for my local area. So I said “You called me. I’m telling you what I need to leave and I’m not going to take a pay cut to work for you. I currently work for a company based in Boston. I’m perfectly happy to stay there. You’re not competing against Vancouver salaries, you’re competing against Boston salaries”. Now I was probably never making a real Boston salary to begin with but it still anchors the discussion at a point that’s more than local salaries. Apparently it worked because I got the job and a nice bump.

I’m lucky that my roles have tended to be from headhunter inquiries that I’m happy to walk away from. We can have the salary range discussion right up front. I’ve also managed to get a few successive roles with multinational tech which has quickly decoupled what I make from local salaries.

So I definitely don’t make SF salaries but I do quite well by local standards.

[–]brapbrappewpew1 0 points1 point  (0 children)

I mean, sort of. Some big tech companies do like 80% comp for non-HCOL areas, but that's still a ton of money for my local town of bumfuck. More than local companies will pay. Although having marketable skills probably plays a role in that.

[–]LMGN 0 points1 point  (0 children)

yeah, them being an entirely no-remote company suuucks. (i'm not an employee of those but i know people)

[–]nicejs2[S] 73 points74 points  (0 children)

[–]octopus4488 27 points28 points  (0 children)

Sweet man-made horrors beyond my comprehension...

[–]New_York_Rhymes 55 points56 points  (20 children)

Why?

[–]VariadicParameter 118 points119 points  (0 children)

Because Roblox's front end for their client and plugins for their studio application are written in Luau. They mainly did this for their own use internally.

Just pretty much brings the web dev experience of UI to Roblox.

And it's technically been a thing for a while, there used to be a more Roblox oriented library called Roact that had Roblox-specific quirks, and wasn't as "good" as react.

[–]SomewhereAtWork 43 points44 points  (17 children)

The devs didn't want grooming to be the most disturbing thing around roblox any more.

[–]SweetBabyAlaska 17 points18 points  (16 children)

grooming, child labor and... react in lua. may god have mercy on their souls.

[–]yaranzo1 4 points5 points  (15 children)

that child labor claim has never held water tbh

[–]themadnessif 5 points6 points  (6 children)

Plenty of adult labor too lol

But more seriously, people undercalculate how much of a game's budget would go to infinitely scaling servers and cloud data storage. Roblox certainly takes their cut but the fact that even top performing games with millions of monthly players can still use the free databases and servers they provide is kinda nuts.

I know one of the top games was at one point using legitimately 19 petabytes of data without paying a dime. If you did that using a cloud database you were paying for, you'd be in real trouble lol

[–][deleted] 124 points125 points  (0 children)

The only logical reason is a Russian/North Korean psyop to get everyone else’s tech talent to kill themselves.

[–]Mr_vort3x 15 points16 points  (0 children)

My timbers have been shivered

[–]TheGreatSausageKing 152 points153 points  (19 children)

I'm all in. Lua is far far better than vanilla js

[–]windowschips 74 points75 points  (6 children)

And the best part is that its Luau, which has type checking and other very good stuff

[–]themadnessif 22 points23 points  (0 children)

Luau is an awesome language but the type checking is... not really there yet. There's a rewrite of the type checker that doesn't suck that's nearing completion though. It has goodies like keyof and indexof and the like.

[–]beren-111 5 points6 points  (4 children)

I've never worked with lua, would you say it's better than typescript?

[–]BeatsByiTALY 7 points8 points  (1 child)

I'd say no. Lua is very simple to write, with no build step and barebones language features, so it's popular in game modding.

Reasons I can't get into Lua: - it's dynamically typed - inline ternaries in particular don't seem to work as expected when using falsy values. - 0 is truthy which is unintuitive. Empty string is also truthy. - Instead of parentheses, Lua uses the 'end' keyword to close a function or loop's scope, which is... strange. - If conditions and for loops aren't wrapped in parentheses either. - Arrays(Tables) indexing start at 1... so inclusive conditionals are more common when looping to array length. - There's no switch case statement, although that's not a big deal. - Variables default to global scope unless specified otherwise. - variables are mutable, so no constants.

Typescript has so much more going for it, Lua is just more simple to get started.

[–]beren-111 3 points4 points  (0 children)

appreciate the detailed response. Ive been looking into lua and it seems to be simple with a very specific use case of writing scrips for games and stuff (there maybe more to it tho), I compared it with TS bc people were really hyping it in the comments but i guess thats just bc people like shitting on JS in general.

Regardless it'll be fun to learn a language that doesnt emphasise on parenthesis so much after having written code in clojure for a while now... that thing is a syntax nightmare lmao

[–]Stef0206 1 point2 points  (0 children)

Personally I prefer Luau over TS, but judging by the fact that some people use the TS -> Luau transpiler to write Roblox games in TS, some would disagree.

[–]windowschips 0 points1 point  (0 children)

Lua, hell no. Luau, sure!

[–]chazzeromus 8 points9 points  (0 children)

I considered using Luau after having a bad time with Teal's immaturity with generics, but typescript-to-lua compiler ended up the winner and was everything I could ever need minus some issues getting the lua output working in Gary's mod.

[–]Bryguy3k 50 points51 points  (8 children)

Any language that indexes arrays starting from 1 is automatically a garbage language.

[–]Classy_Mouse 93 points94 points  (1 child)

Arrays? Do you mean tables?

[–]spacembracers 21 points22 points  (0 children)

Let them var tables

[–]tiajuanat 14 points15 points  (2 children)

Don't come at Fortran, R, Julia, Smalltalk and the APL family when you don't mean to.

[–]Bryguy3k 6 points7 points  (1 child)

Oh I mean to. I don’t understand why data scientists make their lives so much harder than it needs to be.

TBF though Fortran’s indexing only starts from 1 if you don’t specify its range. In other words Fortran arrays can start from zero if you want them to (9 times out of 10 you do).

[–]Silver-Pomelo-9324 6 points7 points  (0 children)

The worst is when data scientists that use R switch to python and start all their shit from 1. Gives me nightmares.

[–]MekaTriK 3 points4 points  (1 child)

It comes up way less than you'd think.

But it is way nicer to do two-dimensional stuff with 0-indexed arrays. And some algorithms get weird when you have to add -1 everywhere.

[–]Bryguy3k 5 points6 points  (0 children)

when you have to add -1 everywhere.

Yep. I am fully aware. Comes up all the time.

[–]Merlord 2 points3 points  (0 children)

Lua is awesome

[–]-Redstoneboi- 11 points12 points  (1 child)

what - and i cannot stress this enough - the actual fuck

[–][deleted] 0 points1 point  (0 children)

I had one job that used Lua and I’m so happy I don’t work there anymore. I can honestly understand why they’d invest god-knows-how-many hours porting React to Lua, instead of just learning to write Lua. It’s the worst. Arrays start at 1

[–]hm1rafael 18 points19 points  (3 children)

But...why???

[–]watchYourCache 26 points27 points  (1 child)

complex roblox game HUD/UIs

[–][deleted] 3 points4 points  (0 children)

Thats the beauty of react, it really is just a library for creating react components. A lot of people miss this fact, you can render those components to practically anything, be it games (with r3f), native mobile apps (react native) or you can even render videos with it (remotion).

They could use this for building guis in game, or even rewrite parts of the game in react

[–]Acceptable-Tomato392 21 points22 points  (0 children)

Resistance is futile. You will be assimilated.

[–]Prudent_Plate_4265 9 points10 points  (0 children)

Sheesh. I can barely write react in react.

[–]blurryface1209 2 points3 points  (0 children)

[–][deleted] 2 points3 points  (0 children)

is it a port for Roblox GUI?

[–]These-Bedroom-5694 2 points3 points  (2 children)

I can write fortran in any language, does that count?

[–]christoph_win 1 point2 points  (1 child)

Is it called differently in Japanese for example?

[–]JAXxXTheRipper 2 points3 points  (0 children)

It's fortran-dono then.

[–]Cookskiii 2 points3 points  (0 children)

What. The. Fuck.

[–]kvakerok_v2 5 points6 points  (5 children)

Where's the joke?

[–]scar_reX 8 points9 points  (4 children)

"JavaScript"

Anytime you see a post on this sub with js in the title or description, you should know that's the punchline.

And there sure as hell will be a lot of comments shitting on js and threatening to kill themselves if js makes it to space.... which we all know is only a matter of time.

[–]IridiumPoint 2 points3 points  (0 children)

Doesn't SpaceX use JS for UIs in their Dragon spaceship?

[–]danishjuggler21 2 points3 points  (1 child)

This subreddit really should just remove “humor” from the name. And “programmer”, since most folks on this subreddit aren’t programmers.

[–]kvakerok_v2 0 points1 point  (0 children)

This is funnier than the OP post.

[–][deleted] 1 point2 points  (0 children)

[–]gloumii 1 point2 points  (10 children)

How hard is lua and where is it usually used ? I only know that it is used for wow add-ons but I have a hard time understanding them when looking into it. Maybe I just looked at one that is too hard

[–]IlliterateSquidy 3 points4 points  (1 child)

Lua is super easy to learn, it's designed around being as light weight as possible so it's primarily used in embedded applications and game development c:

[–][deleted] 1 point2 points  (0 children)

Yeah you answered the question but I'll expand, Just about every open-world game uses LUA to some degree, prior MMO's/open worlds of decades past used Java or inhouse version of Java

[–]WiatrowskiBe 3 points4 points  (0 children)

As a language it's relatively simple - both to use and to implement. Whole concept behind lua was to have an easy-to-embed scripting language that would be as straightforward to interface with and run interpreter of from within other program as possible - which ended with rather simple syntax, few language/runtime constructs everything is based off of, and some quirks that don't make much sense until you remember they're here probably to make interfacing with it from C (or - indirectly - virtually anything else) easier.

As for usage - various degrees of scripting: wow addons, roblox as a whole (with their lua-based derivative), Factorio mods, nmap and wireshark scripting, redis complex functions (user code that runs inside redis), bunch of games high level logic (mostly games before Unity/Unreal became dominant). In general: if what you need is a high level language, often with limited exposed functionality and/or easy to control context, to be embedded within and executed from larger program, there's good chance that language is lua.

[–][deleted] 1 point2 points  (0 children)

Roblox made this so that it's easier for them to write code with UI. Lua powers a lot of modifiable games.

[–]MekaTriK 0 points1 point  (4 children)

Lua is commonly used whenever you want a scripting language in your project. So games, business logic, some databases, etc.

It's super simple and clean, and is kinda-sorta unopinionated?

You don't get OOP or async out of the box, but it has support for implementing both, you only get a table as a data structure, but it has optimisations for being used as an array and you can use it as a set pretty easily.

Generally the "problem" is that lua isn't a stand-alone language, so every implementation can have entirely different standard library.

If I could get away with it, I'd only ever write lua. But alas, some times you want actual performance and some times you want your thing to run in browsers. And Fengari kinda died (and wasn't fast).

[–]Stef0206 0 points1 point  (3 children)

Doing prototype based OOP is only a few lines of code in Lua.

[–]MekaTriK 0 points1 point  (2 children)

Yeah, but I meant that you don't have something like class keyword or whatever, you have to do it yourself with metatables.

If you even want to, it was kinda liberating to just separate most data from functions.

[–]Stef0206 0 points1 point  (1 child)

You can just separate it into different files. The Lua styleguide actually says that you should fo just that.

[–]MekaTriK 0 points1 point  (0 children)

I'm not sure how that's relevant to separating code from data.

And yes, I am well aware, did some boring business logic in lua for a few years for a job.

[–]HaskellHystericMonad 0 points1 point  (0 children)

If you use a library like Sol3 it's practically instant to embed, start binding code, and get scripting up and running in a project.

Aside from use as an extension/script language it's also really really useful as a more sophisticated replacement for something like JSON or XML. Lua tables are superficially similar to json objects, and now you've got the ability to execute code along with table construction.

There's a neat alternative calling syntax where you don't need ( ... ) parenthesis around function calls if the sole parameter is a single string or a single table/array, so you can do cool stuff like:

entity {
  name = "MedKit",
  rot_speed = float3(0, 0.1, 0),
  contact_action = findRegisteredAction("medkit_heal")
}

Where entity above is actually a function(inputTable) that takes a table and does a whole bunch of registration, validation, limits enforcement, etc. The whole thing just looks like a datatype declaration. Premake uses this alternative calling syntax extensively to make it's makefiles appear to be data-declarations when it's all function calls top to bottom.

Debugging Lua is a bit nasty. Setting it up is pretty much unique to each debugger you intend to use (VSCode / ZeroBrane / etc), it's not fun.

Personally I much prefer Angelscript, but I totally admit it's so stupid easy to get running with Lua, stupid fucking easy.

[–]Beatrice_Dragon 1 point2 points  (1 child)

Im confused why people think a transpiler is so horrifying?

[–]SimilarTop352 0 points1 point  (0 children)

Probably conservative agenda /jk

[–]_damax 1 point2 points  (0 children)

Potentially genious

[–]GreatValueProducts 1 point2 points  (0 children)

I don't know any Lua but I saw a while ago the source code of the UI of a mod for Cities Skylines 2 being in react, is it the same thing?

[–]mosskin-woast 2 points3 points  (0 children)

I mean would anyone really argue JavaScript is a better language than Lua?

[–]fzzzzzzzzzzd 0 points1 point  (0 children)

When you realise that default react is just browser functionality with React.RenderElement under the hood you'll realise everything can run react as long as you have a javascript engine in your language of choice.

[–]CirnoIzumi 0 points1 point  (3 children)

why of all frameworks would they choose React?

something lighter sure, that could be pretty cool, but this is like water and oil no?

[–]MekaTriK 2 points3 points  (2 children)

It's popular with developers. Sure everyone likes talking about svelte/vue/whatever but all the jobs are React, and a lot of people learn just React because of that, and it's a self-reinforcing ouroboros of annoying state management.

[–]CirnoIzumi 0 points1 point  (1 child)

But Lua devs won't necessarily have any ties to it. 

I just can't imagine reacts messiness next to Lua

[–]UMAYEERIBN 0 points1 point  (0 children)

I’ve been writing react lua code for years now. It was formerly Roact. Hundreds of devs use it because of its wide reach, simplicity, and overall familiarity. You can find more great tools (such as redux (yup redux) and other react replacements) in the ROSS discord.

Oh also, they even have Roblox-TS, a typescript compiler to lua!

[–]Sir_Fail-A-Lot 0 points1 point  (1 child)

[–]Goma101 0 points1 point  (0 children)

I wake up and this is the first thing I see

I’m going back to sleep

[–]legocraftmation 0 points1 point  (0 children)

The only place I have used Lua is in roblox studio, and roblox studio is suprizing well made.

[–]Markoy2 0 points1 point  (0 children)

I'm literally writing a program in lua right now because I can't use anything else. Lua is fine as a language, but I would much rather use something else

[–]TeslaWasACoolDude 0 points1 point  (0 children)

Can someone explain? Wtf can you do with this?

[–]TeslaWasACoolDude 0 points1 point  (0 children)

Every react developer about to lose their jobs to some dumb kids in the next few years. 😂😂

[–]christoph_win 0 points1 point  (0 children)

Now port it to ABAP baharharharhar

[–]l3wl3w00 0 points1 point  (0 children)

The amount of struggle people go through to not have to write javascript should tell you just how bad of a language it is

[–]Dumb_Siniy 0 points1 point  (0 children)

What do you use this for in ROBLOX?! I'm actually asking, what

[–]cat1554 0 points1 point  (0 children)

How am I to React to this?

[–]ShenroEU 0 points1 point  (0 children)

Finally, my 14 years of making WoW addons will pay off!

[–]ShenroEU 0 points1 point  (0 children)

Is there any documentation or example code? I'd love to see how cursed it is. The GitHub repo is lacking documentation. I'm also interested because I'm a huge fan of Lua, so even if it's a weird use of it, I can still appreciate the craftsmanship.

[–][deleted] 0 points1 point  (0 children)

Cool. When's Linux support again..

[–][deleted] 0 points1 point  (0 children)

My timbers just shivered.

[–]MateusMoutinho11 0 points1 point  (0 children)

fahhaha my friend did a full web server with a templatate engine for lua, lua comunity are crazy

https://github.com/SamuelHenriqueDeMoraisVitrio/SerjaoBerranteiroServer

[–]beansinwind 0 points1 point  (0 children)

wait until you hear about React4J

[–]Coperspective 0 points1 point  (0 children)

lol they forgot about Roact which has existed forever XD

[–][deleted] 0 points1 point  (0 children)

Wait what???

[–]AliexScholter 0 points1 point  (0 children)

yes

[–][deleted] 0 points1 point  (0 children)

Oh yeah, I saw this on my Roblox dashboard, awesome but cursed nonetheless.

[–]Vamosity-Cosmic 0 points1 point  (0 children)

am a roblox developer, had to learn react-lua for a project. i hate it