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.

deleting list entries

Old posts that have not been replied to for several years.
Locked
e
eiSi
Halfop
Posts: 70
Joined: Thu Mar 07, 2002 8:00 pm

deleting list entries

Post by eiSi »

hi there!

I have a problem:

a list:

set list {a b c}

how to delete the entry "b", that the list only looks like this:

{a c}

thanks for any help!
p
ppslim
Revered One
Posts: 3914
Joined: Sun Sep 23, 2001 8:00 pm
Location: Liverpool, England

Post by ppslim »

See the lreplace command.

As well as replacing one value for another, it can delete values too.

To do so, don't spacify a value to replace with.

EG

Code: Select all

set list [list a b c]
set list [lraplce $list 1 1]
The list is now "a c"
e
eiSi
Halfop
Posts: 70
Joined: Thu Mar 07, 2002 8:00 pm

Post by eiSi »

thanks I'll try!
Locked