r/lua • u/jadfe1234 • Jan 01 '26
What are some of your problems with lua?
Love2d and other libraries are welcome but just say what library your talking about
23
Upvotes
r/lua • u/jadfe1234 • Jan 01 '26
Love2d and other libraries are welcome but just say what library your talking about
22
u/AdamNejm Jan 01 '26 edited Jan 01 '26
Lack of type-hints. I'm not talking about forcing a type system, but allowing type annotation in function signatures. While completely optional for 'application' code, I could see it being used in APIs to eliminate bunch of manual type-checking while producing a nice error message with the correct stack trace.
Instead of crashing with 'attempt to index a number' it would produce a message that X function here requires a table, but still leaving it up to the user to ensure they're providing the right kind of arguments.
11
u/Ictoan42 Jan 02 '26
Oh, I've got some thoughts on this subject
continuekeyword. I know it's possible with gotos, but all flow control is possible with gotos and I don't see anyone calling for the removal ofif. We havebreak, but can't stretch tocontinue?~=. Just... why?That being said, I do still really like working in lua.
8
u/kayawayy Jan 01 '26
In 5.2+, goto instead of continue. Bleh.
7
u/MistakeIndividual690 Jan 02 '26
1-based array indexing
4
u/HeavyCaffeinate Jan 01 '26
Lack of basic third party libraries that other languages like python have, I can't find a good pure Lua xml parser for the life of me
4
u/bloodysundaystray Jan 02 '26
It's too good. I'm suspicious of it. It even has the most beautiful name. And lemme tell you, it's the only time I have ever had fun making a class out of tables.
2
u/didntplaymysummercar Jan 02 '26 edited Jan 02 '26
table.createwhich on C side always existed. There's also no way to get size of a table hash part, nocontinuebutbreakandgoto,returnmust be last statement of a block, no!=only~=for inequality (could be both, just like tables allow both comma and semicolon to separate values, and how old Python had both!=from C and<>from Pascal), etc.gotoor table__gc, I prefer how 5.1 handles environments, the performance gains are small and some I copy back into 5.1 (never changing semantics and never using LuaJIT so I can use stock 5.1.5 or my own, or LuaJIT for all my usage), etc.2
u/PurpleYoshiEgg Jan 02 '26
I haven't tested the new globals implementation in 5.5+ yet (still stuck on 5.1 syntax because of LuaJIT), but implicit globals are probably the thing I dislike most.
2
u/ripter Jan 02 '26
I really only have one complaint: the lack of a good package management system. That would help the ecosystem a lot, in my opinion. I worked with JavaScript before it had package management and after. The community really took off once RequireJS, and later official systems, were added to the language.
2
u/y0j1m80 Jan 02 '26
1 indexed
1
u/no_brains101 Jan 01 '26 edited Jan 01 '26
Well, they fixed some of them.
For example in luajit, it's still on the Lua version where __len didn't apply to tables..... And neither does __pairs or __ipairs... And some other stupid metatable bullshit like that
I don't like that nil breaks lists, although I understand why it is that way. At least select('#' exists...
I don't hate 1 indexing enough to really care about that, and I like types but the LSP is pretty good with the type annotations so it's not the end of the world to not have them.
1
u/TheOmegaCarrot Jan 02 '26
I love LPEG, but it’s kinda a shame that if it doesn’t have any error-message-generation capability
I’ve used LPEG as part of implementing an interpreter, and it kinda sucked not being able to give parse-time errors
Of course, a “real” interpreter probably shouldn’t be written in a scripting language, but Lua is nice for prototyping
1
u/Accomplished_Fly_779 Jan 02 '26
Poor multithreading support is rough and gives me doubts about whether it was worth my time to learn when I was previously considering C# which I already had good skills with and am realizing is just straight up faster in the scenarios I'm using lua (c++ scripting API hooking dozens of function calls). I guess luajit is worth considering but at this point I'm thinking I'll just have to keep lua for the non-performance critical stuff and do some interop
1
u/Local-Obligation2557 Jan 02 '26
No proper const annotation and everyone does OOP their own adhoc way
1
u/Parrna Jan 02 '26
I have such a small one but it always is a rock in my shoe that Lua doesn't have incremental shorthands. There's no ++, --, +=.
You can't write MyVariableName += 5, you have to write out MyVariableName = MyVariableName + 5.
I'm sure there's a good reason for it and normally I don't love syntactic sugar in other languages but this one i always really missed with doing work in Lua.
1
u/ggchappell Jan 02 '26 edited Jan 02 '26
Three annoyances from days of old:
More recently, the introduction of attributes and to-be-closed variables in Lua 5.4 was poorly done. (I was working on a Lua iterator-manipulation library, somewhat along the lines of Python's "itertools". But when 5.4 came along, I couldn't figure out any way to do proper handling of to-be-closed variables that appear in iterators. So I gave up the project.)
1
u/envythekaleidoscope Jan 02 '26
I originated learning programming as a whole with Luau in Roblox ever since I was 6 (roughly), and so lots of my annoyances stem from lack of QoL from Luau
table.find... it's just a bit boring to define this in a globals module for each projectcontinuedebate. I don't like having to resort togoto, and a surprising number of libraries for Lua<->Rust/C/C++ communication don't supportgoto.gotois also just archaic as a feature in all honestly, and I've yet to meet a developer who is pro-goto (that's not to say I've not met one that isn't anti-goto)1
u/Zeliss Jan 04 '26
For the language, I’d really love string interpolation and a way to make structures with value semantics (ex. you can make a vec3 and assign it by value instead of just getting a table reference). I’d also love to have some of the standard ++/+=/etc. operators.
1
u/Last-Investigator291 Jan 05 '26
0
u/AutoModerator Jan 01 '26
Hi! It looks like you're posting about Love2D which implements its own API (application programming interface) and most of the functions you'll use when developing a game within Love will exist within Love but not within the broader Lua ecosystem. However, we still encourage you to post here if your question is related to a Love2D project but the question is about the Lua language specifically, including but not limited to: syntax, language idioms, best practices, particular language features such as coroutines and metatables, Lua libraries and ecosystem, etc.
If your question is about the Love2D API, start here: https://love2d-community.github.io/love-api/
If you're looking for the main Love2D community, most of the active community members frequent the following three places:
I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.