Lasso Soft Inc. > Home


AuthorBil Corry
LicensePublic Domain
Posted19 Apr 2006
Updated28 Apr 2006
More by this author...


WARNING: This tag only works with LP8.5!  It will crash LP8.1!

Given an array, it will return the next element in the array.  Can optionally specify the index number using  ->setindex:

lp_array_roundrobin->(setindex: $indexnumber);

Requires [lp_logical_between]

Sample Usage

	var:'test' = lp_array_roundrobin;
	$test->(insert: 'a');
	$test->(insert: 'b');
	$test->(insert: 'c');
	loop: 10;
		loop_count; ': ' $test '
'; /loop; '
'; var:'test' = (lp_array_roundrobin: 1, 2, 3, 4, 5); $test->(setindex: 5); loop: 10; loop_count; ': ' $test '
'; /loop;

Source Code

Click the "Download" button below to retrieve a copy of this tag, including the complete documentation and sample usage shown on this page. Place the downloaded ".inc" file in your LassoStartup folder, restart Lasso, and you can begin using this tag immediately.


	-description='Given an array, it will return the next element in the array.  Can optionally specify the index number.',

	local:'index' = integer;

		self->'index' += 1;
		if: self->'index' > self->size;
			self->'index' = 1;
		return: self->(get: self->'index');

		-required='index', -copy;
		#index = (integer: #index);
		fail_if: !(lp_logical_between: #index, 1, self->size), -1, 'Invalid index value.';
		self->'index' = #index - 1;



Related Tags


No comments

Please log in to comment

Subscribe to the LassoTalk mail list

LassoSoft Inc. > Home



©LassoSoft Inc 2015 | Web Development by Treefrog Inc | PrivacyLegal terms and Shipping | Contact LassoSoft