mIRC Homepage

Variable wrapping...

Posted By: fraggle

Variable wrapping... - 20/01/03 11:02 PM

I was using $calc earlier, and came across an annoyance which lead me to wonder why variables cant be wrapped...

by that I mean that the code... $calc($1+1) is ambiguous - acording to mIRC it has two definitions. One of them is valid for $calc, the other is invalid for $calc. Unfortunately, in this situation, mIRC picks the invalid version (but I'm not suggesting it shouldnt use the invalid version...)

But, what I'd like to see is the ability to wrap variables similar to the TCL stylee - e.g. ${1+} or ${1*}. Now, $1+ is just the simplest example where it might be useful...
but other examples are much more powerful...
${%blah} - call the identifier referenced by %blah
%{%blah} - the variable with the name %blah
I know that these things are already possible with $+, but using $+ is less easy to get right as %{%blah}...

/set %blah bleh
/set %bleh rand

which is easier to read and use?

${%{%blah}}(1,4) ?
$ [ $+ [ % [ $+ [ %blah ] ] ] $+ ] (1,4) ?
$eval($+($,$eval($+(%,%blah),2),(1,4)),2) ?
(perhaps there are other ways to do it but I cant think of them atm)

If there are simpler ways that I have missed, please let me know :P
© 2022 mIRC Discussion Forums