mIRC Home    About    Download    Register    News    Help

Print Thread
#94103 13/08/04 10:35 PM
Joined: Dec 2002
Posts: 17
KyD Offline OP
Pikka bird
OP Offline
Pikka bird
Joined: Dec 2002
Posts: 17
when setting a variable to something that evaluates to "" at runtime, the variable is set to $null instead.
not necessarily a bug, i know, but i find the current behaviour misleading.

the following statement:
Code:
var %x = $1
would set %x to $null if $1 is "", instead of setting it to "", as one would expect.
i think setting the variable to $null instead of "" should only be used in straightforward statements like:
Code:
var %x = ""
because it expresses the intention of setting the variable to $null, unlike when setting a variable to something that evaluates to "". especially when used in the form shown, i don't think the variable should be set to $null, because it would be like it's evaluating the expression twice.

using mirc v6.16.

#94104 13/08/04 10:55 PM
Joined: Dec 2002
Posts: 788
C
Hoopy frood
Offline
Hoopy frood
C
Joined: Dec 2002
Posts: 788
"" is concidered by most languages, including mIRC to be $null.

" " being a space.

Eamonn.

#94105 13/08/04 11:02 PM
Joined: Dec 2002
Posts: 17
KyD Offline OP
Pikka bird
OP Offline
Pikka bird
Joined: Dec 2002
Posts: 17
what if i just want to copy some text in a variable, literally. and this text happens to be "". that's not the same as $null to me. with the current behaviour i'd be forced to check if this text is "", then set it in some alternate way etc...

and the following statement:
Code:
var %x = " "
sets %x to " ", not to a space. the behaviour only occurs with "".

#94106 14/08/04 12:17 AM
Joined: Dec 2002
Posts: 788
C
Hoopy frood
Offline
Hoopy frood
C
Joined: Dec 2002
Posts: 788
In which case you would be screwed and have to check to be sure.

Eamonn.

#94107 14/08/04 12:30 AM
Joined: Dec 2002
Posts: 349
S
Fjord artisan
Offline
Fjord artisan
S
Joined: Dec 2002
Posts: 349
While it's not really a solution, /hadd and /bset do not have this limitation. smile


Link Copied to Clipboard