mIRC Homepage
Posted By: stefys99 $eval() weird behaviour - 08/09/06 03:16 PM
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"
Posted By: starbucks_mafia Re: $eval() weird behaviour - 08/09/06 11:05 PM
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.
Posted By: Khaled Re: $eval() weird behaviour - 12/09/06 11:05 AM
Thanks this has been fixed for the next version.
© mIRC Discussion Forums