Skip to content
Tcl Source Code View Ticket
Login

View Ticket

2004-11-13
06:05 • Closed ticket [1065452fff]: proc - bind MSG - args - invalid. plus 8 other c... artifact: ead6582555 user: dgp
2004-11-12
21:34 • New ticket [1065452fff]. artifact: 0fcb90c748 user: nobody

proc - bind MSG - args - invalid.

Closed / Duplicate1065452fffffffffffffffffffffffffffffffffCreated 22 years agoUpdated 22 years ago
Descriptionplain2004-11-12 21:34:31
per docs at 
http://www.tcl.tk/man/tcl8.4/TclCmd/proc.htm

it states: "If the last formal argument has the name 
args, then a call to the procedure may contain more 
actual arguments than the procedure has formals"

This is a false statement if the proc is binded to a msg.  
It only will work if it is "arg" not "args".  

in a real example:

bind msg -|- !test test

proc test { nick host hand args } {
        
            set myvar1 [lindex $args 0]
            set myvar2 [lindex $args 1]
            set myvar3 [lindex $args 2]
            puthelp "PRIVMSG $nick :myvar1=$myvar1 
myvar2=$myvar2 myvar3=$myvar3"
}

when attached to eggdrop, i receive this.

[14:14] <nick> !test testing this script
[14:14] <eggdrop> myvar1=testing this script myvar2= 
myvar3=

if i change the script to:

bind msg -|- !test test

proc test { nick host hand arg } {
        
            set myvar1 [lindex $arg 0]
            set myvar2 [lindex $arg 1]
            set myvar3 [lindex $arg 2]
            puthelp "PRIVMSG $nick :myvar1=$myvar1 
myvar2=$myvar2 myvar3=$myvar3"
}

I receive this.

[14:18] <nick> !test testing this script
[14:18] <eggdrop> myvar1=testing myvar2=this 
myvar3=script

contact info [email protected]
dgpplain2004-11-13 06:05:51
Logged In: YES 
user_id=80530

Duplicate of 1065440
Log in (anonymous is fine) to add a comment.