Removing a table key?
View Single Post
09-09-14, 08:00 AM
A Chromatic Dragonspawn
Join Date: Jan 2011
Originally Posted by
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.
Last edited by Choonstertwo : 09-09-14 at
View Public Profile
Send a private message to Choonstertwo
Find More Posts by Choonstertwo