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.
Old posts that have not been replied to for several years.
-
Dedan
- Master
- Posts: 260
- Joined: Wed Jul 09, 2003 10:50 pm
- Location: Memphis
Post
by Dedan »
i want to see if text has a second element,
i tried the below and got an error,
any ideas?
input dddd eeeeee
if {[lindex [split $text] 1]} {
putserv "PRIVMSG $channel :mark trig2ger"
return 0
}
[04:44] Tcl error [start:test]: expected boolean value but got "eeeeee"
I once was an intelligent young man, now i am old and i can not remember who i was.
-
user
-
- Posts: 1452
- Joined: Tue Mar 18, 2003 9:58 pm
- Location: Norway
Post
by user »
Tcl doesn't evaluate all non-empty strings as "true" like many other languages. Only "true", "yes" and "on" are accepted as "true" in a expression.
Code: Select all
if {[llength [split $stuff]]==2} {...};# or >=2 if you want it to contain 2 or more, of course :)
Have you ever read "The Manual"?
-
Dedan
- Master
- Posts: 260
- Joined: Wed Jul 09, 2003 10:50 pm
- Location: Memphis
Post
by Dedan »
thanks User

I once was an intelligent young man, now i am old and i can not remember who i was.