ID:1686955
 
BYOND Version:499
Operating System:Windows Vista Home Premium
Web Browser:Chrome 33.0.1750.154
Applies to:DM Language
Status: Open

Issue hasn't been assigned a status value.
Descriptive Problem Summary:
The in operator does not work when you use it with && but the same exact check works perfect if you use the Find proc
Numbered Steps to Reproduce Problem:
Try using the example below, you will see for yourself that there is a problem, the two lines of code should do the exact same thing, but only the second one works.
Code Snippet (if applicable) to Reproduce Problem:
if(src in usr.equipment && istype(over_object,/obj/hud))

if(usr.equipment.Find(src) && istype(over_object,/obj/hud))


Expected Results:

Actual Results:
The actual results I got were that when I used Find it worked, but that was after an hour of trying everything possible to figure out why it didnt work.
Does the problem occur:
Every time? Or how often?
In other games?
In other user accounts?
On other computers?

When does the problem NOT occur?

Did the problem NOT occur in any earlier versions? If so, what was the last version that worked? (Visit http://www.byond.com/download/build to download old versions for testing.)

Workarounds:

This is an order of operations issue.

if(("hello" in my_list) && ("world" in my_list))


That'll give you the expected results.
Sorry I posted something that was already addressed. Searching the forum for the word "in" and "&&" gives lots of results, I didnt see it. Should () always be used no matter what if only as a safety precaution?
In response to LawnMower
LawnMower wrote:
Sorry I posted something that was already addressed. Searching the forum for the word "in" and "&&" gives lots of results, I didnt see it. Should () always be used no matter what if only as a safety precaution?

Pretty much.