Deleting Globals

Something you want to see in a LiveCode product? Want a new forum set up for a specific topic? Talk about it here.

Moderator: Klaus

Post Reply
bjb007
Posts: 313
Joined: Fri Dec 28, 2007 4:56 am

Deleting Globals

Post by bjb007 » Wed Jul 09, 2008 9:41 am

As we can declare

global v1, v2, v3 ...etc.

would be handy to be able to

delete global v1,v2, v3 ...etc

rather than

delete global v1
delete global v2
delete global v3 ....etc.
Life is just a bowl of cherries.

whelkybaby
Posts: 47
Joined: Sat Nov 17, 2007 6:04 pm

Post by whelkybaby » Wed Jul 09, 2008 1:24 pm

If you've got a number of globals to delete, could you not just:

Code: Select all

put "v1,v2,v3,v4,v5" into the lVariableList
repeat with i = 1 to number of items of lVariableList
    delete global (item i of lVariableList)
end repeat
The code could be turbocharged with a 'repeat for each' method, but I thought I'd keep it simple!

Steve

bjb007
Posts: 313
Joined: Fri Dec 28, 2007 4:56 am

Deleting Globals

Post by bjb007 » Wed Jul 09, 2008 2:17 pm

Could do that but would rather
be able to copy the
global declaration line(s) and put "delete"
in front.
Life is just a bowl of cherries.

malte
Posts: 1098
Joined: Thu Feb 23, 2006 8:34 pm
Contact:

Post by malte » Wed Jul 09, 2008 2:37 pm

I also think that would be handy.

Best,

Malte

BvG
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 1239
Joined: Sat Apr 08, 2006 1:10 pm
Contact:

Post by BvG » Wed Jul 09, 2008 10:29 pm

Untested :P

Code: Select all

global a,b,c

on mouseUp
  deleteGlobals
end mouseUp

on deleteGlobals
  put line 1 of the script of me into theGlobals
  delete word 1 of theGlobals
  repeat for each item theItem in theGlobals
    delete global theItem
  end repeat
end deleteGlobals
Various teststacks and stuff:
http://bjoernke.com

Chat with other RunRev developers:
chat.freenode.net:6666 #livecode

Post Reply