Array error only with debug mode

Monkey Forums/Monkey Beginners/Array error only with debug mode

hub(Posted 2015) [#1]


dest : html5 game

Monkey Runtime Error : Array index out of range

why ? only with debug mode actived and no error with the release


Xaron(Posted 2015) [#2]
Well you get that runtime error as well in release but in HTML5 the script will just stop and show nothing. It just doesn't work without an error message.


hub(Posted 2015) [#3]
In fact i don't understand where is the error. Array declaration ? The program work on the html5 target release mode without problem !


Xaron(Posted 2015) [#4]
Ah well that's easy. You have to create that array first, because you've declared it but it's still Null as you don't have an instance yet.

Chaine_Fete = New String[2]
Chaine_Fete[1] = "Marie" <----- NO ERROR ANYMORE ;)



hub(Posted 2015) [#5]
Many thanks Xaron. !