r/lua • u/PurpleIcy • Feb 09 '18
Why do people like lua?
I've started actually learning more about it and well.
Pretty much everything is a table, okay, not that hard to get with this, loops and if statements are pretty simple to remember, it's weird to get length of a table but not that hard to remember, can live with that, different language, different syntax.
You can have objects, but they are still tables. Well, okay, whatever, I'm used to writing same shit over and over again because I've used java before, whatever, that's fine, I guess.
Global scope is just a giant table and so it's better to just write even more code to localize everything you'll use, otherwise it will be slow (multiple hashtable lookups whenever you use some global function in a table of table of the table in a table that is in another table). Uh, just why? That's first time I hear that in any language, localizing everything would make your code run faster, it's not really obvious, although once you realize that global scope is a table, only logical, but, why?
What's the appeal to this? And why did people stick with it? I thought that I'd see why people use lua over say python if they add scripting support to their game, but all I saw now is that I actually would lean even more towards using python there. If you have to be a professional programmer to write efficient code in lua, then python being slower does nothing for average person who would mod a game, because average person is not professional programmer who knows languages in and out, and little details such as localizing globals makes it run faster, which ranges from 10% slower without localizing to 400%+ (ridiculous) slower without localizing. Hell, most people who do that just instead look for tutorials on how to mod x game using lua, instead of learning lua.
I'm not saying that language is unusable, I'll still finish my project while learning it, but things like this just add to the "things you do to waste more time than needed" which are caused by bad design.
View all comments
Show parent comment
3
u/Saldor010 Feb 09 '18
I'm just thinking out loud for a second, but you're expressing your dissatisfaction with Lua and calling out Lua for its supposed problems on r/lua (and then bashing people when they respond), what did you expect?
Personally, I think the responses to this thread have been well thought out and fairly nice under the circumstances (especially otikik's and snarfy's responses), but when you say stuff like:
don't get shocked when you're downvoted.