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 variables

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

Post by CrazyCat »

hi :smile:
I've some troubles with something really stupid:
I've a list of variable which contains topics, as the following:
set comput "Computers & internet"
set business "Business & politique"


one of my procedures have this line:
set rub "comput"
get_topic $rub

where get_topic is another proc.
and now, the trouble:
proc get_topic { rub } {
global comput business chan
set topic $[subst $rub]
puthelp "PRIVMSG $chan :topic is $topic"
}


And it returns "$comput" and not "Computer & Internet".
If I just use set topic [subst $rub] it returns me "comput" and if I try ${$rub} it answer "can't read $rub : no such variable"

How can I do to have $topic set with the value contains in the variable named in $rub?

Thx a lot


User avatar
CrazyCat
Revered One
Posts: 1306
Joined: Sun Jan 13, 2002 8:00 pm
Location: France
Contact:

Post by CrazyCat »

Don't laugh at me :smile:
the good way was set topic [subst $[subst $rub]]

Hope it may help some1 :smile:

_________________
CrazyCat was here...
And on #Dune - irc.epiknet.org

<font size=-1>[ This Message was edited by: CrazyCat on 2002-01-14 12:11 ]</font>
p
ppslim
Revered One
Posts: 3914
Joined: Sun Sep 23, 2001 8:00 pm
Location: Liverpool, England

Post by ppslim »

An alternate way, without the use of subst is
set topic [set $rub]
User avatar
CrazyCat
Revered One
Posts: 1306
Joined: Sun Jan 13, 2002 8:00 pm
Location: France
Contact:

Post by CrazyCat »

OK, I'll try to remember it
Locked