mIRC Home    About    Download    Register    News    Help

Print Thread
#158715 08/09/06 03:16 PM
Joined: Aug 2005
Posts: 128
S
Vogon poet
OP Offline
Vogon poet
S
Joined: Aug 2005
Posts: 128
After some tests, I realised that $eval() takes all it's parameters except LAST and evaluates them as many times as last parameter says. If you use only one parameter for expression and one to specify how many times to evaluate everything works fine.
For example,
//echo -a $eval($!ip,0)
outputs "$!ip"
//echo -a $eval($!ip,1)
outputs "$ip"
//echo -a $eval($!ip,2)
outputs my ip address
However, if you try to use more parameters for expressions, things break when you evaluate more than once
//echo -a $eval($!ip, $!ip, 0)
outputs "$!ip $!ip" (just as it should, each parameter evaluated 0 times)
//echo -a $eval($!ip, $!ip, 1)
outputs "$ip $ip" (just as it should, each parameter evaluated once)
//echo -a $eval($!ip, $!ip, 2)
outputs "$ip $ip" (it should output my ip twice separated by space, but the two expressions are evaluated once each, instead twice each. I also tried using bigger numbers for evaluation, same behaviour)

Edit:
I also tried it on 6.16, in this version only the first used expression is evaluated only once, further expressions are evaluated correctly
//echo -a $($!os,$!os,$!os,0)
outputs "$!os $os $os"
//echo -a $($!os,$!os,$!os,2)
outputs "$os XP XP"

Last edited by stefys99; 08/09/06 03:26 PM.
#158716 08/09/06 11:05 PM
Joined: Dec 2002
Posts: 2,962
S
Hoopy frood
Offline
Hoopy frood
S
Joined: Dec 2002
Posts: 2,962
IMO the only bug with $eval() is that it doesn't return a "Too many parameters" error if more than two parameters are given. Beyond that there's really no bugs since it's undocumented and, as far as I know, unintended behaviour that it evaluates additional parameters at all.


Spelling mistakes, grammatical errors, and stupid comments are intentional.
#158717 12/09/06 11:05 AM
Joined: Dec 2002
Posts: 5,420
Hoopy frood
Offline
Hoopy frood
Joined: Dec 2002
Posts: 5,420
Thanks this has been fixed for the next version.


Link Copied to Clipboard