mIRC Home    About    Download    Register    News    Help

Print Thread
$ini no longer returns 0 #253981 16/07/15 11:56 PM
Joined: Apr 2010
Posts: 921
F
FroggieDaFrog Offline OP
Hoopy frood
OP Offline
Hoopy frood
F
Joined: Apr 2010
Posts: 921
$ini(file, section) and $ini(file, section, 0) used to return 0 if the section did not exist, now it returns null.

Possibly related to:
change #30 of v7.39 (?)


I am SReject
My Stuff
Re: $ini no longer returns 0 [Re: FroggieDaFrog] #253995 17/07/15 03:37 PM
Joined: Dec 2002
Posts: 4,521
Khaled Offline
Hoopy frood
Offline
Hoopy frood
Joined: Dec 2002
Posts: 4,521
Thanks for your bug report. I was able to reproduce this issue.

The behaviour for $ini(file, section, 0) was changed a long time ago as described here. It should not have been changed, as it broke scripts. However, someone must have reported it as a bug and, at the time, it looks like I agreed. However, in retrospect, returning 0 was correct.

In fact, there are several situations where $ini() should return 0 but instead returns $null. If all of these are changed to return 0, as they should, it will break all existing scripts that check for $null, as it did for the user in the older bug report.

The last version that returned 0 for $ini(test.ini, section) if section does not exist was mIRC v6.35. I could change $ini() to match mIRC v6.35 behaviour. However, this would break all scripts that have adapted since 2008. It's a tough call.

Update: I have added the following note to the help file $ini() entry: The behaviour of this identifier varies across versions, where either 0 or $null may be returned for a non-existent item.