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.

Trouble with info exists

Old posts that have not been replied to for several years.
Locked
User avatar
CrazyCat
Revered One
Posts: 1359
Joined: Sun Jan 13, 2002 8:00 pm
Location: France
Contact:

Trouble with info exists

Post by CrazyCat »

Hi there,

I'm creating variables with the content of a file.
The working part:

Code: Select all

foreach templine [split $data "\n"] {
	set faq_line [split $templine "="]
	regsub -all \# [lindex $faq_line 1] "\037" lex_text
	set lexik([string tolower [lindex $faq_line 0]]) $lex_text
}
And then, users can type !lexique <keyword> to call a definition wich is in $lexik(keyword)
But... the following test always match:

Code: Select all

set looking [string tolower [lindex [split $text] 0]]
	if {[info exists $::lexik($looking)]} {
$text is the keyword the user enter... and the tcl always find that an info exists.
Can someone tell me where is the trouble plz?

Thx by advance
User avatar
KrzychuG
Master
Posts: 306
Joined: Sat Aug 16, 2003 2:51 pm
Location: Torun, Poland
Contact:

Post by KrzychuG »

Try this:

Code: Select all

set looking [string tolower [lindex [split $text] 0]] 
   if {[info exists ::lexik($looking)]} {
Que?
User avatar
CrazyCat
Revered One
Posts: 1359
Joined: Sun Jan 13, 2002 8:00 pm
Location: France
Contact:

Post by CrazyCat »

I hate myself :)
Sorry for this really stupid question, I promise I won't re-ask it :)
Locked