Accumulating positional args in an array - code snippet.

Macro depository for macros written before the user variable changes that broke all of them.

Moderator: MacroQuest Developers

GoatFoot
a lesser mummy
a lesser mummy
Posts: 68
Joined: Fri Jan 17, 2003 1:48 am

Accumulating positional args in an array - code snippet.

Post by GoatFoot » Tue Sep 23, 2003 8:20 pm

Code: Select all

sub main

    |  Accumalate positional args into an array.
    |  The number of elements in the array to be
    |  stored as element 0.

	/varset l0 0
	:GetArgs
	/varset l1 p$int($l0)
	/if "$$l1"!="" {
        /varadd l0 1
		/varset a(0,$l0) "$$l1"
		/goto :GetArgs
	} else {
		/varcalc a(0,0) $l0
	}

    | demo
    /for v0 1 to $a(0,0)
		/echo $a(0,$v0)
    /next v0

/return