Quote:
|
Originally Posted by Skyld
If you are using the new engine...
NPC Code:
if (x in {1, 2, 3, 5, 7})
|
I know
you can also do things like
NPC Code:
if ( (x|y) in |22,42| )
Actually, couldn't you have done that in the old engine too (the former)?
However, let's say you have
NPC Code:
if ( x in arr )
I've had a problem in which my array has to contain multiple values. It can't just contain one value. In my movement functions there's generally multiple parameters in the array, but what if you wanted only one value in the array? I've had to use switch (arr.type()) to cope with the language not being very great with array sizes of 1. Of course it's not really an array if it only has one value, but the fact that it's usually an array, it might make it good to have the in operator behave like == when the right operand contains a single value for better dynamic behavior.