MOO-cows Mailing List Archive

[Prev][Next][Index][Thread]

Re: Unusual comparison behaviors



>I know this has always been the way the server works, and its too bad I
didn't think about it before the finalizing of the server, because every so
often this one bites me, as it just did a moment ago, but...
>
>I have a property defaulted to 0 which will be changed to an object #, and
I try this:
>
>if (prop && prop:isa($player))
>
>this doesn't work, why?  read on:
>

object numbers are always false, not true. it's annoying, but I don't know
why they should be either false or true so they might as well be false.


>
>These formulae produce these results:
>
> 1 && #1   -->  #1
> 0 && #1   -->  0
> 
> #1 && 1   -->  #1
> #1 && 0   -->  #1   (shouldn't this be 0?)

Nope, #1 is false so it never gets to 0.

>
>so since:
>
> 2 && 1 && 3  returns 3 (always the last element)
>
>why does
> 2 && #1 && 3  return #1  (the first occurrance of an OBJ)
>instead of 3?

when it gets to a false, it stops and doesn't even look at what's afterwards.

>At this point it doesn't matter anything that comes after the #1, even
> 2 && #1 && 0 returns #1, instead of 0 like (I think) it should.
>
>It doesn't seem to matter what the math is after a type OBJ data is used in
a comparison, it always returns true with that value at that point.



>
>
>--
>chaeon@roc.clawpaw.com  -- Site admin for clawpaw.com
http://www.clawpaw.com
>Chaeon - Site Wiz or K'ryn - Bronze rider,  VirtuaPern Moo
http://www.clawpaw.com/VirtuaPern
>VirtuaPern MOO - telnet dragon.clawpaw.com port 9999
>
>
>
>
>



Follow-Ups:

Home | Subject Index | Thread Index