CommunityNews

CommunityNews

Lua: Good, Bad, and Ugly Parts

I have come across several detailed lists that mention good and not-so-good parts of Lua (for example, Lua benefits, why Lua, why Lua is not more widely used, advantages of Lua, Lua good/bad, Lua vs. JavaScript, and Lua Gotchas), but I found that some of the features that tripped me or that I cared about were not listed, so I put together my own list. It is far from being comprehensive and some aspects of the language are not covered (for example, math and string libraries), but it captures the gist of my experience with the language.

Read in full here:

http://notebook.kulchenko.com/programming/lua-good-different-bad-and-ugly-parts

This thread was posted by one of our members via one of our news source trackers.

Most Liked

OvermindDL1

OvermindDL1

Incremental garbage collector that has low latency, no additional memory cost, little implementation complexity, and support for weak tables.

This is not a pro, this is a con, I OFTEN see the LUA GC consuming more time than the scripts that it itself runs when I profile them in some games and programs, and this just seems utterly crazy. I know it’s mostly the people who write the scripts fault, but the language design encourages that kind of sloppy programming. Now note the mostly, the GC still eats substantial time even when little to no garbage is generated but a a lot of tiny objects are held, even if they are heavily used, it still feels the need to walk everything.

Multiline strings (using [[...]]; can be enclosed with [[...[=[...]=]...]]) and comments (--[[...]]).

This also is not a pro, especially for newbies (of whom lua is supposedly for). Like would have ever thought to use that syntax for multiline strings?! And don’t even get me started on the weird concatenation operator of .., again who would have thought that, especially for a newbie focused language?!

Fast and powerful JIT compiler/interpreter (LuaJIT) which includes FFI library and is ABI-compatible with Lua 5.1 (this means that it can load binary modules compiled for Lua 5.1).

Luajit is indeed amazing, but it’s not standard lua, not made by the lua devs, it’s entirely third part, doesn’t do everything lua can do, has other things that lua doesn’t have, it’s another language, it’s not lua. It’s “mostly” compatible, but even then if you are using the lua C api to bind it instead of its new form you gain almost no speed across API calls because of the marshalling costs, and indeed it can be slower as it often has to marshal something it didn’t have to before. This should be considered another language, not a pro of lua itself.

Tables and strings are indexed from 1 rather than 0.

This, this is just horrifying, don’t know why anyone, anyone would have ever thought this was smart. Instead of a big paragraph just go read this:
https://www.cs.utexas.edu/users/EWD/transcriptions/EWD08xx/EWD831.html

No integers as a separate numeric type; the number type represent real numbers. The next version of Lua (5.3) may change that.

Yeah and this article is showing its age, lua has long since moved past this limitation.

No classes; object-orientation is implemented using tables and functions; inheritance is implemented using the metatable mechanism.

No classes is a “good thing”, how is this marked as different anyway, most languages don’t have classes… o.O

nil and false are the only false values; 0, 0.0, “0” and all other values evaluate as true.

Yeah weak typing is just horrible, like it’s not near as bad as javascript, but it’s still pretty bad…

Non-equality operator is ~= (for example, if a ~= 1 then ... end).

Such a hugely different thing, especially for newbies, how often do people use the Shift+key after all, especially with how much harder it is to hit than!as it requires rotating my hand to hit instead of just translating upwards like for shift+1 for!`.


And basically the rest of it as well, but some of it is not an issue anymore, this article is just really really old.

DevotionGeo

DevotionGeo

I was taking a course on Adobe ColdFusion when I was new to web development. When I heard array indexes in ColdFusion start from 1, I laughed out loud, even if I was a complete noob.

Popular General Dev topics Top

Devtalk
Hello Devtalk World! Please let us know a little about who you are and where you’re from :nerd_face:
New
Devtalk
Our jobs section is for full-time paid positions and for companies to post their own jobs (no consultancies or agencies, sorry!) - simply...
New
dasdom
No chair. I have a standing desk. This post was split into a dedicated thread from our thread about chairs :slight_smile:
New
foxtrottwist
Here’s our thread for the Keyboardio Atreus. It is a mechanical keyboard based on and a slight update of the original Atreus (Keyboardio ...
New
AstonJ
This looks like a stunning keycap set :orange_heart: A LEGENDARY KEYBOARD LIVES ON When you bought an Apple Macintosh computer in the e...
New
herminiotorres
Someone where use Doom Emacs right now? I like to starting this topic to discuss it and learn a little bit more, not just only the emacs ...
New
AstonJ
I love my Kindle Oasis for reading, but unfortunately it’s not great for technical books as you often need to click on a link or do a qui...
New
AstonJ
Saw this on TikTok of all places! :lol: Anyone heard of them before? Lite:
New
Sylvia
About talentbay Our online networking platform connects students with teams in business and industry. It consists of our mobile app for ...
New
AstonJ
Chris Seaton, the creator of TruffleRuby has died. It appears from suicide :cry: He left this note on Twitter on the weekend: And one...
New

Other popular topics Top

AstonJ
SpaceVim seems to be gaining in features and popularity and I just wondered how it compares with SpaceMacs in 2020 - anyone have any thou...
New
New
Margaret
Hello content creators! Happy new year. What tech topics do you think will be the focus of 2021? My vote for one topic is ethics in tech...
New
AstonJ
If you are experiencing Rails console using 100% CPU on your dev machine, then updating your development and test gems might fix the issu...
New
PragmaticBookshelf
Learn different ways of writing concurrent code in Elixir and increase your application's performance, without sacrificing scalability or...
New
AstonJ
Biggest jackpot ever apparently! :upside_down_face: I don’t (usually) gamble/play the lottery, but working on a program to predict the...
New
AstonJ
We’ve talked about his book briefly here but it is quickly becoming obsolete - so he’s decided to create a series of 7 podcasts, the firs...
New
AstonJ
If you get Can't find emacs in your PATH when trying to install Doom Emacs on your Mac you… just… need to install Emacs first! :lol: bre...
New
PragmaticBookshelf
Author Spotlight: Peter Ullrich @PJUllrich Data is at the core of every business, but it is useless if nobody can access and analyze ...
New
NewsBot
V weekly.2025.16 has been released. Link: https://github.com/vlang/v/releases/tag/weekly.2025.16
New