First-Time Initialization problem

Chipp Walters chipp at chipp.com
Wed Oct 19 00:43:03 EDT 2005


Hi David,

If I wanted to init something on a card and run it only once, I'd use 
local variables. This way they're automatically wiped clean on relaunch.

So, in the card script I'd put:

local lNotFirstTime

on openCard
   if lNotFirstTime is not true then
      --> DO INIT STUFF
      put true into lNotFirstTime
   end if
end openCard

Be aware, each time you EDIT the script of the card, you will destroy 
the lNotFirstTime local variable, so it will run your init routines.

-Chipp




More information about the use-livecode mailing list