New Array not empty

Bugs will be moved here once resolved.

Post » Fri Apr 19, 2013 2:08 am

Link to .capx file (required!):
https://dl.dropboxusercontent.com/u/17275929/Temp/Bug%20Test%20-%20Array%20is%20not%20empty.capx

Steps to reproduce:
Create an array and test if it is empty - doesn't seem to be at start.

Observed result:
Array has a count of 1.

Expected result:
Array has an initial count of 0.

Browsers affected:
Chrome: yes
Firefox: yes
Internet Explorer: yes

Operating system & service pack:
Windows XP 7 x64 SP1

Construct 2 version:
r126
Jack of all trades, and master of some.
B
29
S
9
G
7
Posts: 174
Reputation: 7,601

Post » Fri Apr 19, 2013 2:14 am

[quote=manual]Is empty
Test if the array is empty. The array is empty when the total number of elements is zero, calculated as width x height x depth. Therefore the array is empty when any axis has a size of zero. This can be useful when using Array as a data structure (e.g. when pushing and popping values).[/quote]

Your array is 10,1,1 so it's not empty.
If you want it to be empty, make its size 0,1,1 then it will be considered empty.

Moved to closed as not a bug.Kyatric2013-04-19 02:15:13
New to Construct ? Where to start

Image Image
Image Image

Please attach a capx to any help request or bug report !
Moderator
B
247
S
85
G
40
Posts: 6,999
Reputation: 57,793

Post » Fri Apr 19, 2013 2:16 am

Ok, but I cleared it in the layout on start event...? ;) That acts like a bug to me, regardless.
JoyfulDreamer2013-04-19 02:27:09
Jack of all trades, and master of some.
B
29
S
9
G
7
Posts: 174
Reputation: 7,601

Post » Fri Apr 19, 2013 2:30 am

[quote=manual]Clear
Set every element in the array to the number 0.[/quote]

The clear action sets the value of the elements of the array to 0, it doesn't change its size.
When you clear your 10, 1, 1 array, you have 10 zeros when you try to get the value with the action array.at().

The empty condition checks for the size of the array (its number of elements), not the values of its elements.Kyatric2013-04-19 02:31:38
New to Construct ? Where to start

Image Image
Image Image

Please attach a capx to any help request or bug report !
Moderator
B
247
S
85
G
40
Posts: 6,999
Reputation: 57,793

Post » Fri Apr 19, 2013 2:33 am

Ok, not sure why anyone would think "clear" should mean "set all to zero" *for arrays*. Usually it means to clear OUT the items. ;) Anyhow, ok, thanks. Is there a "delete all" action, because I don't see it (other than looping one by one). This just all seems silly to me. :)
Jack of all trades, and master of some.
B
29
S
9
G
7
Posts: 174
Reputation: 7,601

Post » Fri Apr 19, 2013 2:35 am

Ok, never mind, I see the "Set size" clears the array. Man, I have to stop thinking like a programmer. LOL. Thanks.
Jack of all trades, and master of some.
B
29
S
9
G
7
Posts: 174
Reputation: 7,601

Post » Fri Apr 19, 2013 2:36 am

I did read it, but I must have missed it still.JoyfulDreamer2013-04-19 02:38:30
Jack of all trades, and master of some.
B
29
S
9
G
7
Posts: 174
Reputation: 7,601

Post » Fri Apr 19, 2013 2:37 am

Don't hesitate to check the manual it contains the specificities of how Construct 2 works.

Compared to "regular programming language" there are a few subtleties that are specific to C2.
Once you get the hang of it it goes smoother.
New to Construct ? Where to start

Image Image
Image Image

Please attach a capx to any help request or bug report !
Moderator
B
247
S
85
G
40
Posts: 6,999
Reputation: 57,793

Post » Fri Apr 19, 2013 2:40 am

I guess sometimes it's easy to assume, from a developer stand point, what things should do. I'll try to confirm better next time. ;)
Jack of all trades, and master of some.
B
29
S
9
G
7
Posts: 174
Reputation: 7,601


Return to Closed bugs

Who is online

Users browsing this forum: No registered users and 1 guest