array handled differently between HTML and Android

Monkey Forums/Monkey Programming/array handled differently between HTML and Android

semar(Posted 2011) [#1]
Dear all,

in monkey I can use an array without specifing the size:
Local myArray:String[]
myArray[1] = "hello"
myArray[2] = "world"


When I build this code using HTML5 target, and run the application from within a browser, everything works as expected.

The same code compiles also using Android target, but at runtime, on the smartphone, I get an 'index out of range' error.

It works if I change the array declaration and specify the array size:
Local myArray:String[2]


Is this a feature, or a bug ?

Regards,
Sergio.


muddy_shoes(Posted 2011) [#2]
Did you build the HTML5 target in debug mode?


FlameDuck(Posted 2011) [#3]
It depends on how the Array is represented in Java. If it's an [] Array then it's a feature. If it's a Vector or ArrayList, then it's a bug. :)