This is the new home of the egghelp.org community forum.
All data has been migrated (including user logins/passwords) to a new phpBB version.


For more information, see this announcement post. Click the X in the top right-corner of this box to dismiss this message.

Clearing an Array

Old posts that have not been replied to for several years.
Locked
K
Kripton
Voice
Posts: 28
Joined: Tue Jan 06, 2004 6:54 am

Clearing an Array

Post by Kripton »

How do I remove all fields from an array, so there is no data-flied in the array?

U know, 'set arrayname ""' doesn't work
User avatar
caesar
Mint Rubber
Posts: 3778
Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory

Post by caesar »

If you mean delete the array then use "array unset your-array" .. also, you can always have a look here.
Once the game is over, the king and the pawn go back in the same box.
User avatar
user
 
Posts: 1452
Joined: Tue Mar 18, 2003 9:58 pm
Location: Norway

Re: Clearing an Array

Post by user »

If you want the array to exist but be completely empty, you could do

Code: Select all

array unset yourArray *
if you want to remove the entire array, use

Code: Select all

unset yourArray
or

Code: Select all

array unset yourArray
(the result will be the same, but the plain 'unset' is less verbose :P) If you want to create an empty array to reserve the name or whatever, do

Code: Select all

array set yourArray {}
Have you ever read "The Manual"?
K
Kripton
Voice
Posts: 28
Joined: Tue Jan 06, 2004 6:54 am

Post by Kripton »

Thanx caesar for the complete TCL-Guide!

I just knew the TCLGuide from SunInet, which explains the most important, but not all functions!
User avatar
caesar
Mint Rubber
Posts: 3778
Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory

Post by caesar »

Heh. Your welcome. Yes, is an nice web page. I have sow it in the topic of channel #egghelp on freenode (actualy in topic from the stats page of that channel) :)
Once the game is over, the king and the pawn go back in the same box.
Locked