mud:boolean_values

This shows you the differences between two versions of the page.

— |
mud:boolean_values [2019/08/08 13:48] (current) admin created |
||
---|---|---|---|

Line 1: | Line 1: | ||

+ | There are three types of Boolean Values in MUX: BITS, BOOLEAN, and BOOLEAN-Z. In each case, a Boolean Value is either TRUE or FALSE, and all possible strings are mapped onto one of those two. | ||

+ | |||

+ | <code> | ||

+ | 1. The most comprehensive definition of Boolean Value is denoted simply as | ||

+ | BOOLEAN. Newer functions and features use the BOOLEAN definition of a | ||

+ | Boolean Value. MUX maps the following to FALSE: | ||

+ | |||

+ | - Numbers (integer and floating-point) with a value of zero. | ||

+ | - The Special floating-point values of NaN, Ind, +Inf, and -Inf. | ||

+ | - Strings with zero-length. | ||

+ | - Any error message of the form "#-N <msg>". | ||

+ | |||

+ | All other strings are understood as TRUE including negative numbers and | ||

+ | dbrefs. | ||

+ | |||

+ | 2. BITS is another form of a Boolean value. An integer can be broken down | ||

+ | into BITS. Taken together, the server shows them as an integer, but | ||

+ | there are functions which indirectly manipulate individual BITS. | ||

+ | |||

+ | 3. BOOLEAN-Z defines FALSE as an integer zero. This definition still | ||

+ | appears in MUX for softcode compatibility. | ||

+ | |||

+ | Alphabetic strings are FALSE. Everything after the decimal point in a | ||

+ | floating-point number is ignored. Dbrefs are not recognized but mapped | ||

+ | to FALSE. TRUE is then any non-zero number. | ||

+ | |||

+ | </code> | ||

+ | |||

+ | NOTE: T() allows a BOOLEAN value to be used with a BOOLEAN-Z function, and Boolean Values from functions can be interpreted correctly by either BOOLEAN or BOOLEAN-Z definitions. | ||

+ | |||

+ | Examples: | ||

+ | <code> | ||

+ | not(foo) --> 0 not() --> 1 not(-66) --> 0 | ||

+ | not(0) --> 1 not(#-1) --> 1 not(#12) --> 0 | ||

+ | t(1) --> 1 t(#-1) --> 0 t(-66) --> 1 | ||

+ | </code> | ||

+ | |||

+ | Related Topics: [[mud:not()]], [[mud:t()]] | ||

mud/boolean_values.txt ยท Last modified: 2019/08/08 13:48 by admin