Lasso Soft Inc. > Home

[lp_iterate]

Linklp_iterate
AuthorBil Corry
CategoryUtility
Version8.x
LicensePublic Domain
Posted19 Apr 2006
Updated17 May 2006
More by this author...

Description

Similar to iterate, but does not require the looping var.

Sample Usage

lp_iterate: (:'a','b','c');
	loop_item;
/lp_iterate;

lp_iterate: (:'a','b','c'), local:'abc';
	#abc;
/lp_iterate;

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.

[

define_tag:'lp_iterate',
	-description='Similar to iterate, but does not require the looping var.',
	-priority='replace',
	-looping,
	-required='data',
	-optional='loop_item';

	// based on code from John Burwell, LPA list 8/18/2005

	local:'return' = string;
	local:'varname' = '_lp_loopitem_' (lp_string_random: 4);
	(var:#varname) = null;

	process: "[
		define_tag:'loop_item',-priority='replace';
			return: @$"#varname";
		/define_tag;
	]";
	
	if: (local_defined:'loop_item');
		#loop_item = @(var:#varname);
	/if;
	
	loop: #data->size;
		(var:#varname)->detachreference;
		(var:#varname) = @#data->(get: loop_count);
		#return += run_children;
	/loop;

	return: #return;
	
/define_tag;

]

Comments

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