Here is some samples. Maybe they can be added to the help docs. First thing is to be carefull with array index 0, every array has one or maybe not. Basically these commands allow you to create dynamic arrays with different methods to access them. You can use the array,list,queue,stack commands all on the same array depending how you want to process the array. So you can create a list then process it as a stack and use it as an array all at the same time. The usage seemed bulky to me at first because you need to create a blank and then set the value but I believe this is because you can have array of types and thus need to fill in multiple values. Use this queue sample if you need a function that handles variable amount of parameters.
dim MyAry(0) as string
MyAry(0) = "Index 0 is here"
array index to stack MyAry()
add to stack MyAry()
MyAry() = "World"
add to stack MyAry()
MyAry() = "Hello "
add to stack MyAry()
MyAry() = "2"
print AddStrings()
print MyAry(0)
undim MyAry(0)
wait key
function AddStrings()
RetVal$ = ""
t = val(MyAry())
remove from stack MyAry()
for x = 1 to t
RetVal$ = RetVal$ + MyAry()
remove from stack MyAry()
next x
endfunction RetVal$
dim MyAry(0) as string
array index to queue MyAry()
`Remove the Dimed item from the queue
remove from queue MyAry()
add to queue MyAry()
MyAry() = "2"
add to queue MyAry()
MyAry() = "Hello "
add to queue MyAry()
MyAry() = "World"
add to queue MyAry()
MyAry() = "6"
add to queue MyAry()
MyAry() = "Hello "
add to queue MyAry()
MyAry() = "World "
add to queue MyAry()
MyAry() = "This "
add to queue MyAry()
MyAry() = "Is "
add to queue MyAry()
MyAry() = "A "
add to queue MyAry()
MyAry() = "Test."
array index to queue MyAry()
print AddStrings()
print AddStrings()
undim MyAry(0)
wait key
function AddStrings()
RetVal$ = ""
t = val(MyAry())
remove from queue MyAry()
for x = 1 to t
RetVal$ = RetVal$ + MyAry()
remove from queue MyAry()
next x
endfunction RetVal$
dim MyAry() as string
print array count(MyAry(0))
array delete element MyAry(),0
print array count(MyAry(0));" ooops"
`not working - array insert at top
`not working - array insert at element
array insert at bottom MyAry()
MyAry() = "Hello "
print array count(MyAry(0))
array insert at bottom MyAry()
MyAry() = "World "
array insert at bottom MyAry()
MyAry() = "This "
array insert at bottom MyAry()
MyAry() = "Is "
array insert at bottom MyAry()
MyAry() = "A "
array insert at bottom MyAry()
MyAry() = "Test."
array index to top MyAry()
do
print MyAry();
next array index MyAry()
if array index valid(MyAry()) = 0 then exit
loop
print
for x = 0 to array count(MyAry())
print x; " ";MyAry(x)
next x
undim MyAry(0)
wait key