News for hackers. Stuff that matters.
Re:Lua, a Misunderstood Language by soapdog on Friday January 15, 2021 @07:20PM (#25798505)
hey, I'm the author of the article. Thanks for linking.

That being said, I'm always impressed with the fervour and effort that people put into complaining about Lua 1-based indexing. Folks, using a Meta Table, you can change the indexing to be 0-based. It is such a small thing. Dissing a language full of potential and flexibility because of that is overreacting.

Also, those wishing Lua was friendlier environment catering to the needs of young audiences should remember that Lua was not created for that market, but that an environment that does that can be built on top of Lua. You want teach your kid a fun language, teach them a Lisp. It is easy, regular, and fun. Go with Racket. The error messages are good. Or, help someone who is making a Lua-powered game development environment make their app more friendly towards younger audiences. That is not a language's fault.

The main part of that article is to approach Lua as a toolkit. Do you want zero-based arrays? Do you want errors to be triggered for undeclared variable access? You can built a Lua environment with all of that. Want batteries, you can add them too.

For those asking about table copy, lodash, etc. Lua is minimalistic. If you want to add a bit of weight, I recomend using penlight library:

https://lunarmodules.github.io/Penlight/

(for example, here is table copy function from penlight: https://lunarmodules.github.io/Penlight/libraries/pl.tablex....)

Re:Lua, a Misunderstood Language by viraptor on Friday January 15, 2021 @07:27PM (#25798558)
> Folks, using a Meta Table, you can change the indexing to be 0-based. It is such a small thing.

That sounds like a terrible idea. Both consistent 0-based and consistent 1-based is much better than "0/1 depending on who wrote this part".

Re:Lua, a Misunderstood Language by soapdog on Friday January 15, 2021 @07:31PM (#25798583)
As I mentioned. It is a toolkit. You can make it 0-based and then use it everywhere as zero based. You don't need to mix it. In my opinion, it is not worthy it. I just mentioned it to highlight that if you truly want that, you can do it. It was more to show that it is flexible language and that you can roll your own. Not that I advocate doing it.
Re:Lua, a Misunderstood Language by TillE on Friday January 15, 2021 @07:41PM (#25798673)
> those that are on the "Lua should hold my kid's hand while programming" bandwagon

This is such an odd, needlessly hostile way to address people. What "bandwagon" is this?

Re:Lua, a Misunderstood Language by soapdog on Friday January 15, 2021 @07:46PM (#25798711)
Sorry, I didn't mean to be hostile. I'll rephrase that better.
Re:Lua, a Misunderstood Language by soapdog on Friday January 15, 2021 @07:49PM (#25798722)
Edited that comment, I hope it is better now.