this post was submitted on 11 Feb 2025
473 points (97.2% liked)
Programmer Humor
20039 readers
1194 users here now
Welcome to Programmer Humor!
This is a place where you can post jokes, memes, humor, etc. related to programming!
For sharing awful code theres also Programming Horror.
Rules
- Keep content in english
- No advertisements
- Posts must be related to programming or programmer topics
founded 2 years ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
view the rest of the comments
In Lua all arrays are just dictionaries with integer keys, a[0] will work just fine. It's just that all built-in functions will expect arrays that start with index 1.
PHP did that same thing. It was a big problem when algorithmic complexity attacks were discovered. It took PHP years to integrate an effective solution that didn't break everything.
Your argument isn't making me any happier - it just fills me with more rage.
That's slightly misleading, I think. There are no arrays in Lua, every Lua data structure is a table (sometimes pretending to be something else) and you can have anything as a key as long as it's not nil. There's also no integers, Lua only has a single number type which is floating point. This is perfectly valid: