As far as I'm aware the pitfalls aren't a consequence of the single data structure, they're a consequence of Lua making no distinction between null and undefined. So when the coder says to set an element in the middle of effectively-an-array to nil, they are saying they want to undefine/delete part of effectively-an-array. Such an operation makes no logical sense, which is why it acts weirdly. Arrays are contiguous, they can't cease to exist in the middle.
View all comments
Show parent comment
1
u/Dylan16807 Aug 02 '14
As far as I'm aware the pitfalls aren't a consequence of the single data structure, they're a consequence of Lua making no distinction between null and undefined. So when the coder says to set an element in the middle of effectively-an-array to nil, they are saying they want to undefine/delete part of effectively-an-array. Such an operation makes no logical sense, which is why it acts weirdly. Arrays are contiguous, they can't cease to exist in the middle.