mIRC Home    About    Download    Register    News    Help

Print Thread
$addtok #56864 22/10/03 11:13 PM
Joined: Jul 2003
Posts: 33
B
Bilge Offline OP
Ameglian cow
OP Offline
Ameglian cow
B
Joined: Jul 2003
Posts: 33
If $addtok is passed nothing (i.e. $null) as the token to add to the string, then $addtok returns $null. I should expect that it would return the same string that was passted to it (i.e. nothing to add, so nothing added).

Re: $addtok #56865 23/10/03 05:26 AM
Joined: Oct 2003
Posts: 13
T
temporal Offline
Pikka bird
Offline
Pikka bird
T
Joined: Oct 2003
Posts: 13
Prior to version 5.91, $addtok(foo,$null,32) would return "foo $null". From 5.91 onwards, nothing is returned at all. Presumably this behaviour is a result of the following note in versions.txt:

15/06/2001 - mIRC v5.91
(…)
37.Improved the way $null is handled in scripts.


Anyway, I agree that this isn't logical behaviour.
$deltok is also effected; $deltok(foo bar,$null,32) should sensibly return “foo bar” i.e. Take nothing away.


___________________________
10110101 = -75
Re: $addtok #56866 23/10/03 11:51 PM
Joined: Jul 2003
Posts: 33
B
Bilge Offline OP
Ameglian cow
OP Offline
Ameglian cow
B
Joined: Jul 2003
Posts: 33
It is most annoying when trying to debug loops. My loop returns $null, when I am sure I added things using $addtok. I did, but then this strange behavior deletes everything if the last value added happens to be $null. But it's things like this which never get fixed. I suppose I will just have to do my own checking every time I need to use token identifiers.

Re: $addtok #56867 26/10/03 09:47 PM
Joined: Oct 2003
Posts: 7
D
dbm Offline
Nutrimatic drinks dispenser
Offline
Nutrimatic drinks dispenser
D
Joined: Oct 2003
Posts: 7
I've also noticed $null returning "$null" rather than evaluating
to "" (nothing/null) particularly when using $+() and $iif()
together.. I forget how to recreate it right now, but I've run
into it a few times.. I emailed Khaled about it a while back
(around 6.01 I think) with and example but he never fixed it.
*pokes Khaled*
-dbm

Re: $addtok #56868 27/10/03 02:15 PM
Joined: Jul 2003
Posts: 33
B
Bilge Offline OP
Ameglian cow
OP Offline
Ameglian cow
B
Joined: Jul 2003
Posts: 33
That was probably just you getting confused. Especially since you cannot recreate it.

Re: $addtok #56869 27/10/03 02:45 PM
Joined: Feb 2003
Posts: 810
C
cold Offline
Hoopy frood
Offline
Hoopy frood
C
Joined: Feb 2003
Posts: 810
No, this bug exists and it was reported before. It happens when you use $null and $iif as $+() parameters. Putting a null parameter before an $iif() one bugs it.

$+($null,$iif(1,1)) = $null1
$+($null,blah,$iif(1,1)) = $nullblah1
$+($null,$iif(1,$null),blah) = $nullblah
$+(,$iif(1,1)) = $null1
$+(,blah,$iif(1,1)) = $nullblah1
$+(,$iif(1,),blah) = $nullblah

These work:
$+($null $iif(1,1),blah) = 1blah
$+($iif(1,1),$null) = 1

Last edited by cold; 27/10/03 02:48 PM.

* cold edits his posts 24/7