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.
Quinie
Voice
Posts: 27 Joined: Fri Jan 09, 2004 5:29 am
Location: NL
Contact:
Post
by Quinie » Sun Jul 18, 2004 5:56 am
From 1 proc i call another proc that makes a sql querie.
I want to give the value of this querie back to the first prog. So the first proc can uses this value.
Can anyone tell me how to do this.
Ofloo
Owner
Posts: 953 Joined: Tue May 13, 2003 1:37 am
Location: Belguim
Contact:
Post
by Ofloo » Sun Jul 18, 2004 10:25 am
one word one command
global varname
check out tcl manual on
www.tcl.tk
XplaiN but think of me as stupid
Quinie
Voice
Posts: 27 Joined: Fri Jan 09, 2004 5:29 am
Location: NL
Contact:
Post
by Quinie » Mon Jul 19, 2004 4:22 am
This will change it into a global variable.
In that case it tought the value of the variable will not be emptyd as the proc ends.
But then again as i'm thinking i can drop it myself ofcource.
But can't this be done during the running of the procs only.
Like using the Return function or the upvar and getvar ?
caesar
Mint Rubber
Posts: 3778 Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory
Post
by caesar » Mon Jul 19, 2004 8:30 am
Yes, upvar i think is what you are looking for.
The Manual wrote:
upvar - Create link to variable in a different stack frame
or hmm.. uplevel - Execute a script in a different stack frame?
Once the game is over, the king and the pawn go back in the same box.
Quinie
Voice
Posts: 27 Joined: Fri Jan 09, 2004 5:29 am
Location: NL
Contact:
Post
by Quinie » Tue Jul 20, 2004 3:02 am
Could some-one post a example of upvar and/or uplevel.
Because i can't get it to work (i think it's me
)
KrzychuG
Master
Posts: 306 Joined: Sat Aug 16, 2003 2:51 pm
Location: Torun, Poland
Contact:
Post
by KrzychuG » Tue Jul 20, 2004 5:03 am
Code: Select all
# $Id: loader.tcl,v 0.2 2004/05/06 18:19:32 [Xp-AvR] Exp $
namespace eval ::loader {
# Format:
# botnet-nick "tcls to load"
array set Tcl2Load {
ipv4 "scripts/tcl1.tcl scripts/tcl2.tcl"
ipv6 "scripts/tcl2.tcl"
bnc "scripts/tcl3.tcl .data/.scripts/tcl55.tcl"
} ;# Tcl2Load
# LoadTcl
proc LoadTcl { } {
global botnet-nick
variable Tcl2Load
foreach tmpx [lsort [array names Tcl2Load]] {
set botx [lindex $tmpx 0]
if {${botnet-nick} == $botx} then {
foreach tclx $Tcl2Load($botx) {
uplevel #0 source $tclx
}
return 0
}
}
return 0
} ;# LoadTcl
LoadTcl
} ;# namespace eval loader
Que?
Quinie
Voice
Posts: 27 Joined: Fri Jan 09, 2004 5:29 am
Location: NL
Contact:
Post
by Quinie » Wed Jul 21, 2004 7:46 am
Well thanks it's nice to know some-one is trying to be helpfull. But it still doesn't give me any idea on how uplevel works. As I little by little understand more of TCL i still have a hard time figuring things out by meself.
It's just like the mann pages, if you are not native english or have studied it it's very hard to read. And i'm not natvie english or have studied it
From the man pages (
www.hume.com/html84/mann/upvar.htm ) i can understand you can only use uplevel is the first letter of your variable is a # or a digit.
But after that it's all some nice english [censored] for me. Are these mann pages also avalible in Dutch or could some-one explain it to me in more simple words. Because i would like to know what i'm doing. With two hours of coding i might get it to work but then i still don't know what i'm doing.
caesar
Mint Rubber
Posts: 3778 Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory
Post
by caesar » Wed Jul 21, 2004 10:47 am
Translate to your native language then.
Once the game is over, the king and the pawn go back in the same box.
Quinie
Voice
Posts: 27 Joined: Fri Jan 09, 2004 5:29 am
Location: NL
Contact:
Post
by Quinie » Wed Jul 21, 2004 11:36 am
Well now it even harder to read..
Well i think i'm just going to experiment. and lets see what happens.
I know now that i have to use upvar.
Papillon
Owner
Posts: 724 Joined: Fri Feb 15, 2002 8:00 pm
Location: *.no
Post
by Papillon » Wed Jul 21, 2004 11:46 am
You don't
have to use upvar
Code: Select all
proc bla {bla bla bla} {
#call proc 2 and catch the result
set result [bla2 bla]
}
proc bla2 {bla} {
#do the sql querie and return the result
return $result
}
... easy way to do it
Elen sila lúmenn' omentielvo
Quinie
Voice
Posts: 27 Joined: Fri Jan 09, 2004 5:29 am
Location: NL
Contact:
Post
by Quinie » Wed Jul 21, 2004 12:02 pm
Thx.. working great...
you just made my day