Speeding up array initialization

Rob Cozens rcozens at pon.net
Sat Nov 22 10:04:53 EST 2003


>Let's say I have a variable S made of 100 lines of 100 items each,
>and I want to initialize each item of each line to 0.

Salut JB,

put empty into S
repeat with x = 1 to 100
   put empty into item 100 of line x of S -- creates a string of 99 commas
end repeat
replace "," with "0," in S
replace return with "0"&return in S

If you know regular expression syntax, you can probably replace the 
two replace commands with one call to replaceText.
-- 

Rob Cozens
CCW, Serendipity Software Company
http://www.oenolog.net/who.htm

"And I, which was two fooles, do so grow three;
Who are a little wise, the best fooles bee."

from "The Triple Foole" by John Donne (1572-1631)


More information about the use-livecode mailing list