k, did some testing and this is the winner:
code:
function arraycomp($1, $2, optional $m)
dim $,$n
for each $ in $2
if (ascan($1,$)>-1&$m)|ascan($1,$)+$m<0 $n=$n+chr(1)+$ endif
next
$arraycomp = split(substr($n,2),chr(1))
endfunction

as you see, you also did not dim the $n...
_________________________
!

download KiXnet