3 ms·
Except the standard libraries, all third party libraries, and every existing Lua user maintaining your code will assume 1-based indexing. Cars don't require yo
by munificent 11y ago
Except the standard libraries, all third party libraries, and every existing Lua user maintaining your code will assume 1-based indexing.
Cars don't require you to drive on the right side of the road either (or whatever side your nationality prefers), but you're going to have a bad time in traffic if you try to switch.
- fit2rule 11y agoIf you need 0-based arrays, use them. Its no big deal. Any Lua programmer worth their salt knows that Lua uses 1-arrays - so? Set up a 0-array and off you go.
- qwertyuiop924 11y agoEither you're an idiot, or you're being sarcastic. I will assume the ladder.
- fit2rule 11y agoIn fact, I'm learning a lot from this thread, particularly about idiocy and sarcasm, although very few actual real arguments for why array[1] is 'inferior' to array[0], because in fact there is no such valid argument. Lua standard libraries do not suffer this problem. If you have a legacy / cross-platform issue about it, well then .. its a good thing one is 'wise enough to know array[0] is a thing', but its hardly relevant to the question of whether this 'inferior accessing of arrays in Lua' is anything more than fallacy. Idiomatic Lua involves intelligent use of pairs/ipairs/table index schema, and metatables if needed, to solve the data-access problem. And guess what? A competent Lua developer either has had zero problems with this issue (because they are competent and know how to wire up a C/C++ data structure to the Lua vm), or they have infinite, multiple "problems with Lua", of their own devising, nevertheless, but hey .. you can't "blame Lua" for that. Lua gives you the keys to the universe. If you crash into someones mailbox, well then ..