4 ms·
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 abou
by soapdog 6y ago
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/ https://lunarmodules.github.io/Penlight/
(for example, here is table copy function from penlight: https://lunarmodules.github.io/Penlight/libraries/pl.tablex.html#Copying https://lunarmodules.github.io/Penlight/libraries/pl.tablex....)
- TillE 6y ago> 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?
- viraptor 6y ago> 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".
- soapdog 6y agoAs 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.