wiremod/wire

E2 array:count() broken on non-sequential arrays

Denneisk opened this issue · 2 comments

array:count() will return an incorrect value for arrays that have non-sequential elements.

print(array(100 = 100, 200 = 200):count()) # prints 0

Expected behavior:
Prints 2.

Vurv78 commented

Believe sparse arrays are undefined behavior.

I'm personally against supporting them

Vurv78 commented

Unless you want to make an rfc to completely change how arrays should be treated, I don't think this should happen.
Would make them slower too