<DIV><BR><BR><B><I>Richard Gaskin <ambassador@fourthworld.com></I></B> wrote:
<BLOCKQUOTE style="PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #1010ff 2px solid"><BR><BR><BR>>> I tend to use them in two circumstances:<BR>>> <BR>>> - where I might have used globals but want to<BR>>> avoid name-space collisions<BR>>> (great for utilities and plugins where you have<BR>>> no control over the name space)<BR>> <BR>> "name space" is a new expression for me. ???<BR><BR>It's geekspeak for "the range of all possible names".<BR><BR>> after all this, i am back to declaring<BR>> temporary/in-handler locals. a trade off<BR>> between extra text versus having all variables<BR>> declared at the beginning of each handler.<BR>> using handler + parameters to pass info<BR>> involves the same kind of trade off.<BR><BR>When you get the hang of using script-local vars, they serve a different<BR>olace from globals and parameters, and are useful in their own right, worth<BR>becoming familiar with.<BR><BR>If you've been declaring them with "global" I can understand the confusion,<BR>as theyt would then act as common local vars (the "global" declaration is<BR>ignored outside of handlers).<BR><BR><BR>> using the script/static approach generated<BR>> some very strange results:<BR>> <BR>> local sHolder = empty # no quotes<BR>> put the actual "e-m-p-t-y" string into sHolder<BR>> in the first handler that ran<BR>> the only instance i have ever seen where empty<BR>> did not resolve to just that.<BR><BR>If you post the actual code we can identify the problem.<BR><BR>> there was a loop where:<BR>> <BR>> local i # outside any handlers<BR>> on xxx<BR>> repeat with i = 14 to 18<BR>> # on the first pass (i = 14) fine,<BR>> # on the second pass (i = 5)<BR>> put goGetum() after sHolder<BR>> end repeat<BR>> end xxx<BR>> <BR>> function goGetum<BR>> repeat with i = 1 to 5<BR>> doSomething<BR>> end repeat<BR>> end goGetum <BR>> <BR>> this is the only case in my experience where<BR>> repeat with i = <BR>> did not follow orders<BR><BR>This may be a case of the propgram doing what you told it rather than what<BR>you intended. :)<BR><BR>In the first loop, you initialize i to contain 14, but then in its repeat<BR>loop you cann another handler which uses the same variable to count from 1<BR>to 5, so when it returns i contains the last value set: 5.<BR><BR>> take home thought:<BR>> use script/static locals very carefully<BR><BR>Or maybe the take home thought is simply:<BR>If you need two different repeat loops to count independently, you two<BR>different variables as the counter.<BR><BR>-- <BR>Richard Gaskin <BR>Fourth World Media Corporation<BR>Developer of WebMerge 2.2: Publish any database on any site<BR>___________________________________________________________<BR>Ambassador@FourthWorld.com http://www.FourthWorld.com<BR>Tel: 323-225-3717 AIM: FourthWorldInc<BR><BR>_______________________________________________<BR>use-revolution mailing list<BR>use-revolution@lists.runrev.com<BR>http://lists.runrev.com/mailman/listinfo/use-revolution</BLOCKQUOTE></DIV><BR><BR><FONT style="BACKGROUND-COLOR: blanchedalmond" color=blanchedalmond><FONT color=orangered><FONT color=blue>erik@erikhansen.org</FONT> </FONT><FONT color=darkred>http://www.erikhansen.org</FONT></FONT><p><br><hr size=1>Do you Yahoo!?<br>
<a href="http://us.rd.yahoo.com/finance/mailsig/*http://tax.yahoo.com">Yahoo! Tax Center</a> - File online, calculators, forms, and more