6 ms·
Because the arrays start at 1.
by jrockway 17y ago
Because the arrays start at 1.
- silentbicycle 17y agoDude, you can find a reason to write off every language in existence. Lisp has all those parens. Python has the whitespace. Perl...is Perl. Etc. Nothing's perfect. Lua's a pretty good language, though. It's completely replaced Python as my default language (much like Python replaced Perl years before), because, while it too has its surface annoyances, it makes a lot of other very intelligent trade-offs. For example, indexing arrays from 1 is a consequence of ensuring that Lua would have a syntactic subset usable as a data description language by non-programmers. It's almost identical to Javascript's JSON in that regard, but has been used in production as such for well over a decade. Likewise, Lua's rather spare standard library is because the language strictly* limits itself to the ANSI C standard. In exchange, though, it's portable to literally anything with an ANSI C compiler, including freaking Legos (http://www.hempeldesigngroup.com/lego/pbLua/ http://www.hempeldesigngroup.com/lego/pbLua/). The whole thing fits in a 200ish KB library, too. Not bad for something as expressive as Scheme and Python. * With the exception of dynamic linking, which can potentially provide everything else down the line.
- jrockway 17y agoYeah, I like Lua. I was just trying to be funny :)
- chipsy 17y agoI chuckled because it felt fresh, but it does come off as another kind of programmer-snark like better-known cliches about Lisp(parens), Python(whitespace), Java(overengineering), etc.
- cubicle67 17y ago+1 for pbLua. I've used it for a few things and it's brilliant. Docs are pretty good too. Protip: Having kids is a great way to legitimise buying things like Mindstorms. eg, without kids - "I just spent $300 on Lego" "Wow, what a sad life you lead". with kids - "I just spent $300 on Lego" "Wow! What an awesome parent you are. My Dad never did anything like that for me"
- baddox 17y agoUnless you don't want them to.
- silentbicycle 17y agoWell, sure, as of 5.2.0 there's a new __ipairs metatable, but you're swimming against the current of the existing libraries.
- fab13n 17y agoKind of similar to using Lisp macros to have infix operators: because you can do it doesn't mean it's a good idea.