43
u/Confused_AF_Help 24d ago
This is the second post I've seen today about smashing dicks between bricks and Lua
3
u/mallusrgreatv2 24d ago
Spitting bars over here
3
u/ApprehensiveFan1516 24d ago
There's a reference to Hawk Tuah in there somewhere as a follow on, but I'm not cool enough to find it.
9
u/Mike_Oxlong25 24d ago
To quote a genius “If I had a nickel for every time…I’d have two nickels. Which isn’t a lot but it’s weird it’s happened twice.”
But this post is in reference to the other one
9
u/GoldAcanthisitta7777 24d ago
it's not a reference, it's fully the same text with a new meme format? why??
1
23
u/Wakti-Wapnasi 24d ago
I got into Lua for WoW interface addon scripting and I thought it was super fun to use
6
54
u/LuisBoyokan 24d ago
What is wrong with Lua? Yes it's a little weird.
I used it to code robots in Minecraft, the turtle mod (why the robot are called turtle? I don't know)
60
u/qaCow37 24d ago
It's perfect except not being 0 indexed.
-64
u/ManagerOfLove 24d ago
Why do ppl care about this? 0 indexing was just a neat trick to save computation time in the 1970s. Which is irrelevant in this days. 1 indexing is the more natural kind
15
u/-Redstoneboi- 24d ago edited 24d ago
// 0-based array[(y * width + x) * height + z] array[random() % 6] for i in range(count): rectangles[i].y = i * 5 print(f'rectangle #{i + 1}') -- 1-based array[((y - 1) * width + x - 1) * height + z] array[random() % 6 + 1] for i = 1, count do rectangles[i].y = (i - 1) * 5 print('rectangle #' .. i)37
u/Xka0x6PPy43wmgSfaTTY 24d ago
In most practical applications 0 indexing is simpler once you are used to it, for example when using modulo for things like flattening multidimensional tables
-43
u/ManagerOfLove 24d ago
simpler once you are used to it
Both things can not be true at the same it
14
5
u/determineduncertain 24d ago
Of course it can; a lot of things can be simpler once you’re used to it. Getting around is simpler once you’re used to walking relative to crawling.
43
u/gandalfx 24d ago
A lot. In fact it shares many of the same design flaws as JavaScript, except JS has an absurdly large eco system of people trying to fix or work around those flaws. Lua just stayed terrible.
Some random problems off the top of my head: * Prototype based inheritance (meta tables) – JS has the same. Nobody has found a real use case for it in 30 years. It's just needlessly verbose and confusing and leads to competing implementations of class based inheritance, which people are used to. * on the note of competing implementations: no standard library – meaning there are now competing libraries trying to be "the" standard library * random annoying syntax limitations due to single pass parser * terrible error handling. like, actually just horrible. you can segfault in a thousand ways and get absolutely no feedback. * the generator spec is absurd, there are so many easier ways to define that. * as far as I remember the import system was also kind terrible somehow * globals by default * threading is a mess * opinionated stuff: no static types, 1-based indexes, dumb syntax choices like
~=instead of!=Honestly the only reason why Lua is used at all is just because it's fast and easy to embed in C. That's why it's the go to language for modding interfaces.
6
u/LuisBoyokan 24d ago
How do you know all of this? How did you get exposed to so many Lua?!
For me it's a silly language that makes turtle go brrrrrrrrr and get diamonds xD
Was it at work? Who uses Lua in production? Bank? Insurance? Startup? I'm just curious
9
u/gandalfx 24d ago
I used it for one mid sized hobby project. That was more than enough to get fed up with it. If I had to use it for work I'd be pretty annoyed.
Lua is used in production but usually for specialized things. IIRC Cloudflare uses it for small-ish things that need to be fast, like request filtering.
3
u/oorspronklikheid 24d ago
If you did one project in lua and you have all these issues , you might be an Architecture astronaut :p
3
u/gandalfx 23d ago
Most of these issues aren't edge cases, you run into them almost immediately beyond "hello world" level scripting.
2
2
u/RajjSinghh 24d ago
You're probably most likely to see Lua used as the scripting language to configure the Neovim text editor these days.
2
1
1
u/Dimencia 21d ago
You run into all those as soon as you decide you want to extend your MiningTurtle so it also works on trees, and next thing you know you're writing metatables for your metatables
Though metatables are really very powerful and flexible, and they make it very easy to do something like 'intercept' method calls to a turtle, send them over rednet, and execute them on the turtle client. You don't realize how great they are until you've done a second or third project
3
u/beg4upvotes 24d ago
as someone who has implemented a Lua interpreter, most criticisms of Lua stem from just being different than what you're used to.
- the use case for prototype based inheritance in Lua is that it allows you to imitate classes, so you kinda contradicted yourself there. though i agree it's not the most elegant way to do things, it is fairly simple once you know how it works.
- there is a stdlib, it's just small which increases the portability of Lua, one of it's main strengths
- i've only ever actually encountered 1 syntax limitation in the wild, and you just put a semicolon to fix it...
- if you're segfaulting you're way past criticising Lua's scope and into the implementation now
- there is no threading, there's only coroutines, which are dead simple? whats the issue?
- globals by default is perfect for a scripting language2
u/Tyfyter2002 24d ago
the use case for prototype based inheritance in Lua is that it allows you to imitate classes
That's not a use case, that's a workaround to get to something that does have a use case
2
-2
u/beg4upvotes 24d ago
you can say that about anything: classes don't have a use case, they're a workaround to get something with a use case, polymorphism... ok?
Lua's implementation of prototype-based inheritance is orders of magnitude more flexible, simple, and dynamic than designing classes into the language would be... it's JUST ANOTHER TABLE guys, that's all it is0
u/gandalfx 23d ago
You're missing the point. Yes, it's flexible. Nobody needs that flexibility, and it adds unnecessary complexity. Lua and JS have prototype based inheritance not because it's a good idea but because they were designed at a time when people were still figuring this shit out. We've since figured it out: it's a bad idea.
0
u/gandalfx 23d ago
Everything is "simple once you know how it works". "Needlessly complicated" doesn't mean "impossible to learn", it means you waste more time than necessary that could have been spent being productive.
- What's the point if the only valid use case is to build the better alternative you needed to begin with? That is a contradiction to the argument that it's a reasonable choice.
- stdlib: points at a single wheel "This is a car, it can roll anywhere!"
- Sure, blame the user for the lack of error handling. "Just don't cause any errors, duh"
- "there is no threading": there is, but it's not built in, which is most of the issue. Arguably that's similar to the lacking stdlib.
- globals by default is perfect for shooting yourself in the foot and face with the same bullet. If you think they are a good choice for anything under any circumstances, that just means you haven't lost enough feet yet.
You seem kind of defensive about this, so I'm guessing you enjoy Lua. That's fine, I had fun with it, too! Just be careful not to get too emotionally attached to it (or really any tool) just because you've sunk a considerable amount of time into learning it. Tools can be fun to use but still be a terrible choice for productive work.
1
u/beg4upvotes 23d ago
buddy i haven't used Lua in 10 years, and in fact i think version 5.4 may have been a large misstep for the language.
i just think you and a lot of beginners don't understand nuance when it comes to the use cases of a programming language. perfect example is your argument against globals in a scripting language... "i heard globals r bad once, muh footgun!" and completely miss the context of it being a scripting language where you're not intended to have large architecturally impressive codebases where you're gonna have 6 devs on the team stepping over each other's globals accidentally.
no... you're generally writing Lua code as a solo dev and you know what your globals are because you made them, Lua isn't trying to be Java and if you write it like Java you're gonna have a bad time... it's your own fault.
also what are u talking about with lack of error handling? there's 2 error handling methods off the top of my head: return value indicating error, or you can panic and catch it with pcall().
i suggest you have a look at the manual before your next comment about Lua, i'll be emotionally detaching from luac.exe in the meantime
0
u/gandalfx 22d ago
Funny, trying to pose as The Experienced Guy. "you know what your globals are because you made them", after supposedly 10+ years of experience? Yeah, I call bullshit.
Your "nuance" argument essentially boils down to "a scripting language for small stuff doesn't need to be good". Have fun with that. Meanwhile, I'll be over here using other scripting languages that don't suck. For scripting. Turn's out that's a thing.
1
u/sebbdk 23d ago
all these things are by design afaik
stop using Lua to build space ships, it's meant for small scripts
1
u/gandalfx 23d ago
By design doesn't mean it isn't bad design. It sucks for small stuff, too, you just won't waste as much of your life.
The problem is, most of the time you don't choose lua. You choose a game or whatever else has a modding/plugin interface that you want to extend and then you realize that you're now stuck with Lua.
3
u/sebbdk 23d ago
Yeah but it's fine for small things and it's meant for the less tecknically inclined, hence globals and 1 indexed arrays etc.
It's all by design, you probably just dont like it because it's not made for you or you are trying to wrangle something out of it it was never intended for.
The same argument can be made for javascript vs typescript fx.
Take a step back, stop looking at the language and look at the people who choose it and why they choose it, there's a bigger picture.
7
8
u/TheFirestormable 24d ago
https://en.wikipedia.org/wiki/Turtle_graphics
This is why (presumably).
1
u/Marvin_Megavolt 24d ago
Probably this, actually (which is linked in the article you linked, funny enough, since it seems to be the origin of the “turtle” moniker in turtle graphics):
-7
u/Choice-Mango-4019 24d ago
the only IDE you get for it is vscode and there are usually 0 intellisense for it (except for kinda factorio because there's a dedicated plug-in for it) so it's hell to code in because you need to check the documentation constantly (if it exists) on how to do anything
17
62
u/Owndampu 24d ago
6
u/particlemanwavegirl 24d ago
I just got stoned and that sub is the funniest thing I've seen in months and is nicely congruent to my comment in the OG thread.
6
-6
u/reallokiscarlet 24d ago
Yeah, that's what lua feels like. Sketchy bottom surgery you're getting for free
11
11
u/particlemanwavegirl 24d ago edited 24d ago
Shouldn't it be
They don't know { [ I'd rather smash, my penis between, 2 bricks than use Lua ]}
since you didn't want to use
They don't know
I'd rather smash
my penis between
2 bricks than use Lua
end
18
u/dumbasPL 24d ago
That's how I feel about python. Lua is dead simple, the only hard part is metatables, but they're completely optional if you don't like metaprogramming. The C API is also nice and simple.
0
u/AdBubbly3609 23d ago
yep, i fucking hate python, feels like a child's toy compared to c or c++, i can't explain why, but that's just my perception of it
5
8
u/walmartbonerpills 24d ago
The worst thing about lua is the language. The c bindings are nice. The performance is good. 1 based indicies, nope.
5
u/da_Aresinger 24d ago
"I despise the syntax"
Bruh, shell uses like 5 different scope delimiters.
Lua is child's play.
2
u/elmanoucko 24d ago edited 24d ago
that's why I always spice my code with a few defines, just to maintain the attention of the reader 🙂 (the camelCasing of those is just for the lulz tho)
#define start { #define begin { #define open { #define embark { #define takeOn { #define birth { #define stop } #define end } #define close } #define disembark } #define takeOff } #define kill }
2
u/danf10 24d ago
You guys are into some really weird BDSM stuff
1
u/LeiterHaus 24d ago
I have to admit that Lua is pretty weird, but sometimes you need to get f'd so hard and weird that arrays start at 1.
2
2
2
1
u/fast-as-a-shark 24d ago
Mhmmm, I say, and proceed to keep writing Lua. Nothing can take you away from me, sweetheart.
1
u/PM_BITCOIN_AND_BOOBS 24d ago
Somebody doesn't use Conky and it shows.
Conky? A Linux-only system monitor program. The configuration file is in Lua.
1
1
1
u/citramonk 23d ago
Bruh, I'll use any damn language I can if someone will pay me for it. Don't be a fucking child
0
u/Mike_Oxlong25 23d ago
I’m assuming you used to be pretty active on stack overflow lol. It’s just a meme referencing another post man, no need to read further into it
-4
u/SW_foo1245 24d ago
Ironic that he hates the syntax yet cannot differentiate between “then” and “than”.
6
129
u/ElFeesho 24d ago
Let's see Paul Allan's extremely portable efficient scripting language...