The best I could do was:

function stackIsOpen pLongID
  set the itemDelimiter to "/"
return (char 1 to -6 of item -1 of pLongID) is among the lines of the openStacks
end stackIsOpen

which on a 1.5mhz G4 powerbook took 150 ms for 1000 iterations. (checking the windowID took 500 ms).

The trouble with 'value(word wordoffset("stack",pLongID)+1 of pLongID)' is that given the long id of a stack, it returns the full path of the stack, so is never in the openStacks.

Best,

Mark

On 14 Apr 2006, at 18:08, Richard Gaskin wrote:

J. Landman Gay wrote:
Richard Gaskin wrote:
Sounds like an opportunity for the gang here to come up with a fast way to parse the stack name.
function objStack pLongID
   return value(word wordoffset("stack",pLongID)+1 of pLongID)
end objStack
Didn't time it. One-liner though. :)

Well done:  0.027ms (1GHz G4)

I'd considered the value function, but sometimes I get skittish about it for fear of object names that may evaluate to valid expressions.

But apparently since the name is in quotes it doesn't matter -- I even named my stack "time()" and it still only returned the first- level evaluation (removing the quotes to obtain the string "time()").

Good job, Jacque.

--
 Richard Gaskin
 Managing Editor, revJournal
 _______________________________________________________
 Rev tips, tutorials and more: http://www.revJournal.com
_______________________________________________
use-revolution mailing list
use-revolution@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution

_______________________________________________
use-revolution mailing list
use-revolution@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution

Reply via email to