mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: Sep 2005
Posts: 2,881
H
hixxy Offline OP
Hoopy frood
OP Offline
Hoopy frood
H
Joined: Sep 2005
Posts: 2,881
I think it would be very handy if mIRC supported an extra parameter in things like $readini, $hget, etc for returning a value when that topic/item/etc does not exist.

For example. Consider the following table:

Table
Item - Data
Item2 - Data2

$hget(table,item,x) would return Data as "item" exists in the table.
$hget(table,item3,y) would return y as "item3" does not exist in the table.

This is possible already with $iif($hget(table,item3) != $null,$v1,y) but I think it would be a neat and tidy little shortcut.

Joined: Oct 2003
Posts: 3,918
A
Hoopy frood
Offline
Hoopy frood
A
Joined: Oct 2003
Posts: 3,918
Way too complicated and inconsistent to introduce a parameter across the board like that. There should be a construct for it instead. Something that works no matter what identifier is used. Something like:

Code:
$@($hget(...), DEFAULT)


oh wait, that's right, you can do that yourself:

Code:
alias @ { return $iif($1 != $null, $1, $2) }


- argv[0] on EFnet #mIRC
- "Life is a pointer to an integer without a cast"
Joined: Sep 2005
Posts: 2,881
H
hixxy Offline OP
Hoopy frood
OP Offline
Hoopy frood
H
Joined: Sep 2005
Posts: 2,881
Ha, that's not a bad idea. Cheers.

Joined: Apr 2004
Posts: 759
M
Hoopy frood
Offline
Hoopy frood
M
Joined: Apr 2004
Posts: 759
Apart from the fact that i personally doubt Khaled will bother (no offense intended) in some languages you can asign as followed:

var %x = $hget() || Value if null

by that nature

var %x = ($hget() || Default value)

could return $true and $false which would be very handy to have indeed. Think returning $false or $true without the obligatory if statements.




$maybe

Link Copied to Clipboard