Daniel Mallett
Member
This should be a simple fix but I can't find anything on the forums. I want to find out if a specific position in an array has been set as I don't know how big the array is going to be. I don't want to initialize them all with a loop as I don't want to artificially cap the number of entries, nor do I want to expand the array size manually.
I found is_undefined but that only seems to work for the array as a whole and not individual values. I can't ask if it's null because it might not exist to ask. I'm a bit confused by this.
For example if test[0] exists but test[1] does not I can't do test[1] += "xyz" but I can do test[1] = "xyz";
If I can't check for its existence I can't clear it before using it in case it already contains data.
Edit: I believe the answer is going to be no there is no function to do this. Please correct me if there is, but I'm being forced to pre-assign the array values and bite the bullet. I didn't want to do this because it requires extra checks and unnecessary code and also puts an artificial limit on the number of entries that can be made. This makes me a little sad to be honest.
I found is_undefined but that only seems to work for the array as a whole and not individual values. I can't ask if it's null because it might not exist to ask. I'm a bit confused by this.
For example if test[0] exists but test[1] does not I can't do test[1] += "xyz" but I can do test[1] = "xyz";
If I can't check for its existence I can't clear it before using it in case it already contains data.
Edit: I believe the answer is going to be no there is no function to do this. Please correct me if there is, but I'm being forced to pre-assign the array values and bite the bullet. I didn't want to do this because it requires extra checks and unnecessary code and also puts an artificial limit on the number of entries that can be made. This makes me a little sad to be honest.
Last edited: