Clearing local variables

Sannyasin Brahmanathaswami brahma at hindu.org
Fri Apr 22 21:48:15 CEST 2016


When doing list processing… it is not unusual to end up with duplicated data in persistent variables.

Local tWhatEverList  # is persistent, like a global, for the script that contains it. So if you are putting data into it on a repeat loop… it gets added every time the cmd/fnc is called.

I tried this:

set the itemdel to comma # just to sure...
put "tAllCats,tCatsTree,tRootCats,aAllCatsArray,aCatsByParent,aCatsByChild,tAllChildren" into tLocalVars
   repeat for each item x in tLocalVars
      put empty into x
   end repeat
   put tAllChildren; exit to top #Monitor

But all the variables are not emptied.

I was forced to resort to long hand

    put empty into  tAllCats
    put empty into tCatsTree
    put empty into tRootCats
    put empty into aAllCatsArray
    put empty into aCatsByParent
    put empty into aCatsByChild
    put empty into tAllChildren
??
BR


More information about the use-livecode mailing list