mIRC Home    About    Download    Register    News    Help

Print Thread
isin vs. findtok #171510 25/02/07 04:36 AM
Joined: Jan 2007
Posts: 1,156
D
DJ_Sol Offline OP
Hoopy frood
OP Offline
Hoopy frood
D
Joined: Jan 2007
Posts: 1,156
Im curious what people's opinions are on this.

Lets say I want a hopflood protection on for 3 rooms.
$hget(prot,hopflood) = $chan1 $chan2 $chan3

What do you think is better?

if ($chan isin $hget(prot,hopflood))

if ($findtok($hget(prot,hopflood),$chan,1,32))

And please explain why you feel that way. Thank You!!

Re: isin vs. findtok [Re: DJ_Sol] #171511 25/02/07 04:46 AM
Joined: Aug 2004
Posts: 7,252
R
RusselB Offline
Hoopy frood
Offline
Hoopy frood
R
Joined: Aug 2004
Posts: 7,252
In this case, I would use $findtok, since the usage of isin could match partials.
For example:
Chan 1 = #Testing
Chan 2 = #testicles

If the current channel was #Test, then using isin would match both of the channels listed, even though the specific channel isn't listed.

Using $findtok would check the entire channel name in the list and compare that to the channel being used, and return no match (which in this example would be correct)


Re: isin vs. findtok [Re: DJ_Sol] #171515 25/02/07 05:12 AM
Joined: Dec 2002
Posts: 2,962
S
starbucks_mafia Offline
Hoopy frood
Offline
Hoopy frood
S
Joined: Dec 2002
Posts: 2,962
If you just want to check for the presence of the channel name I'd use the hidden third answer: $istok. You shouldn't use isin for the reasons RusselB mentioned.


Spelling mistakes, grammatical errors, and stupid comments are intentional.
Re: isin vs. findtok [Re: starbucks_mafia] #171543 25/02/07 04:53 PM
Joined: Oct 2004
Posts: 8,327
Riamus2 Offline
Hoopy frood
Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,327
Right, $istok is much better than $findtok for something like that.


Invision Support
#Invision on irc.irchighway.net