書いてから気づいた
こんな処理を以前に書いたかもw

FILE名:FILE_step?ar.hsp
#define ERROR -128*256*256*256
#module step_ar ar index
#modinit int p
dim ar,p
index=0
return
#modfunc local set int p_index,int value
ar.p_index=value
return
#modfunc local set_index int p
index=p
return
#modcfunc local get
if length(ar)>index{
n=ar.index
index++
return n
}
return ERROR@
#global
/*TEST CODE コメントアウト
newmod a,step_ar,16
repeat 16
set@step_ar a,cnt,cnt
loop
repeat 20
mes get@step_ar(a)
loop*/