Possible to Alias an Array?
SRLM
Posts: 5,045
Hi. I was wondering if it was possible to alias an array? The first element is no problem, but when a reference (#) is added, such as
numberTwo·VAR numberArray(2)
The compiler displays a message about expectations:
Expected ':' or end of line
Also, using HIGHBYTE or BYTE0 variations does not work. Is there in solution to this?
·
numberTwo·VAR numberArray(2)
The compiler displays a message about expectations:
Expected ':' or end of line
Also, using HIGHBYTE or BYTE0 variations does not work. Is there in solution to this?
·
Comments
buffer0 VAR Word ' first element of implied array
buffer VAR buffer0 ' implied start of array
buffer1 VAR Word ' second
buffer2 VAR Word ' third
'additional aliases to second element
someNum VAR buffer1
Now, to treat it as an array, just use the array element syntax ON THE FIRST variable of the list...subsequent defined vars of the same size will fall into line automatically:
buffer(0) = 1 ' same as buffer0 = 1, or buffer = 1
buffer(1) = 2 ' same as buffer1 = 2
buffer(2) = 3 ' same as buffer2 = 3
someNum = "XX" ' same as buffer1 = "XX" or buffer(1) = "XX"
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
When the going gets weird, the weird turn pro. -- HST
1uffakind.com/robots/povBitMapBuilder.php
1uffakind.com/robots/resistorLadder.php
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Chris Savage
Parallax Tech Support