Since there is no documentation/examples that I can find about (array) I had a guess as to how it works, but have come across some strange behaviour. With the following script I would expect the same results, but they differ.

Code:
; _spindlespeed set to 12000
(clear)


(print,This doesn't work)
(array,4000,SHR[[#<_spindlespeed>*100/60],8],AND[[#<_spindlespeed>*100/60],255])
(print,#4000)
#<i> = 0
O<print> repeat [#4000]
    #<q> = [#[4001+#<i>]]
    (print,#<q,0>)
    #<i> = [#<i>+1]
O<print> endrepeat






(print,This does work)
#<speed_lo> = SHR[[#<_spindlespeed>*100/60],8]
#<speed_hi> = AND[[#<_spindlespeed>*100/60],255]
(array,4000,#<speed_lo>,#<speed_hi>)
(print,#4000)
#<i> = 0
O<print> repeat [#4000]
    #<q> = [#[4001+#<i>]]
    (print,#<q,0>)
    #<i> = [#<i>+1]
O<print> endrepeat
The output I get is:

Code:
This doesn't work
4.000
1
8
16
255
This does work
2.000
78
32

I don't understand why it is different and the wrong output contains more data than I expected and it seems completely wrong. I hope you can explain.

Thanks
Simon