Open ghost opened 1 year ago
That's strange... It seems to work as expected for me!
Have you got any errors in DevTools about it? Do you know if the type conversion error occurs for print array
or just print array[0]+1
?
I forgot to mention, yes, the error only occurs at array[0]+1
. What is weird, is that it works on the phone, but both devices keep atto up-to-date. I can't check it on the PC right now, but when I can, I will write more info.
What is even weirder is that it still works on my phone, but when it's in this code (it's on the bottom of the comment), it doesn't work on both devices (coord2Array[0] is a normal number). I tried running this code (on the phone) and tried these commands:
dim abc:push 23,abc:print abc[0]+2
(returns 25, works ok)
print coord2Array[0]+2
(Type conversion error
)
Basically, it's like this:
Even if I am doing something wrong, the simple dim x:push 1,x:print x+1
command returns different results on different devices. I don't think it should have problems converting 2 into a number though.
Weirdly, it works on PC now, but not in the code. Here's a DevTools screenshot of running this code on PC. There are no new error messages after the conversion error.
It might not seem immediately obvious, but coord2Array
items appear to be strings, which won't work with the +
operator! To get it to work, you'll need to modify your program to be:
304 value0=coord2Array[0]:value1=coord2Array[1]
305 push value0%+sin(goAngle%);";";value1%+cos(goAngle%),snake
At the moment, list items can't be casted to a number like coord2Array[0]%
, so the items must be stored in variables that can then be subsequently casted. It might be worth modifying atto and making the +
operator automatically cast strings to numbers (just like how ;
basically casts numbers to strings when used) to prevent the confusing type conversion error
, so I'll keep the issue open for that.
For some reason I can't do arithmetic operations with array elements. (
Type conversion error
) Example:dim array:push 1,array:print array:print array[0]+1