0 (zero) in the first cell of an array doesn't initialise
Creating an array and manually placing a zero in the first cell (first index location) doesn't initialise the array. It is, instead, <null> in this location, still. So any efforts to replace the contents of this first cell of the array result in an untraceable error.
I just spent an hour discovering this. Please, if someone puts a zero into this location, make it initialise just as it does if a 1 or an "a" or anything else is put in this location. It was a deliberate act to put the zero there, and I never thought more of it as it matched the index, so was the easiest thing to put in that location to initialise the array.
It was only as a last resort, after trying every single other conceivable thing(s), that I finally got around to thinking... "maybe the reason that array is always failing to respond is that zero doesn't initialise it..."
You cannot imagine my surprise when I found that to be true. Zero is an integer, so I had wrongly assumed I'd initialised it with an int, as an array of ints, so could immediately replace the contents of that first cell when and how I wanted. Nope.
Replace doesn't work for a <null>. Something else that's interesting.
This, for those of you reading along and wondering, is a bug report, observation, critique AND a complaint.
I want that hour back.
iTap Development last edited by iTap Development
@Deeeds I can't reproduce this. Setting an array to [0,"1"] from json, or using an array behaviour and setting the values to 0 and 1, or anything else I can think of work fine.
The only thing that returns a null value for me is accessing an index out of bounds or manually creating an array such as [,"1"] from json.
How are you initialising the array and what is returning a null value?
Creating an array and manually placing a zero in the first cell (first index location) doesn't initialise the array.
Somehow you're doing everything that is not this:
@Deeeds this array works normally for me. I can get the array value at index 0 and it returns 0. In json form the array shows as ["0"]; it's treating the 0 as a string,
Here's a screenshot:
The text input returns the get array value output and the json form of the array.
@Jack8680 Same exact thing, I get
@Jack8680 I've found a solution to part of this, that I only casually observed in the first part of this post, setting that first indexed item to something other than 0, and then back to zero.
Having done that, it's found and initialised the array and I can use 0 in that location.
But the first time, each time, 0 isn't working.
I've also found that the first time I attempt to access an array with a new Get Value from Array behaviour, I need to restart hyperPad before it will work at all. Before the restart it's as though it cannot find the array.
It could simply be that constantly overwhelming the cocos2D drawing of hyperPad behaviours causes all sorts of interesting issues with everything in hyperPad, but I'm only noticing it within arrays because that's what I'm using most of the time, for most everything.
Force quitting and then restarting hyperPad has become my new normal.
When that's no longer beneficial and performance really degrades, I hard restart the iPad and get a solid boost back to 60fps.
This is working fine for me as well. Could it be that you're not actually setting it back to zero?
@Hamed In the first screen shot I've shown in this thread, I'm manually creating the array, and manually creating a cell, then entering zero in the first cell.
The first time I try to access this array, in any way, it's returning null.
On some attempts to access existing and populated arrays, I'm also getting null returns.
The only fix, for me, is to restart hyperPad, then the exact same code, untouched, begins to operate correctly.
This is much the same as the thread on negative numbers not working in an array. These are issues that seem to be happening as a result of the extended durations of my usage of hyperPad. I am often working in it for a few hours at a time, fiddling with graphics and physics settings, adding new functionality and game features, and then figuring out something I want to do with an array, at which point these things happen that are very weird.
@Deeeds so doing the following returns <null> in your text input?
@Jack8680 Not in a new project, and not in a new work session.
But after a while, yes.
And... all other newly created access to ALL pre-existing arrays will also return null, once that problem starts occurring.
And all sorts of other issues rear up and become a nightmare of uncertainty, too.
There is a cumulative degradation in the way hyperPad operates, this is one of those.
The first time I saw this was the weirdness in the report regarding negative numbers in arrays.
As previously noted, restarting hyperPad, and the iPad, clears this up, and many other undesired or otherwise wrong activity.
As also previously noted, I'm mostly noticing these degradations and gibberish in Arrays, but have also seen it with conditionals.
Jack8680 last edited by Jack8680
@Deeeds it's weird that you're getting all these bugs; I don't think I've ever had a bug in a game that was fixed by restarting hyperPad, other than visual bugs in the editor. Is your device jailbroken?
@Jack8680 No, not jailbroken.
But my project is large. Build times are anywhere from 10 seconds to 20 seconds, which is much longer than it was...
I've just pruned it... gotten rid of all of the iterative "scenes", and still having problems.
Thecheater887 last edited by
You should try reinstalling, in a.l honesty.