Originally Posted by zork
Yeah updated my post. Found it in the last sentence of the lib tutorial.
When running ipairs on a table with keys that are set to nil. Are those entries still returned? I mean the key should still exist?!
|
Keys don't "exist" in tables unless they have a non-nil value. In the internals of Lua there may be some difference between a key with a nil value and a key without a value; but this difference isn't exposed in the language.
ipairs iterates until it hits a nil value and then stops. If keys 1, 2, 3 and 5 of your table have values, ipairs will iterate up to 3 and then stop.