isnull
isnull <value>
Whether a value is null — the absence of any value.
This is the exact complement of exists: [isnull $x] is the
same as [not [exists $x]]. Built-ins that may fail to find something —
first, nth, carrier,
object, mob — return null, and isnull is the
natural way to detect that.
Arguments
<value>— any value.
Returns
A bool — true when the value is null (or a stale entity reference), false otherwise.
Examples
after command (say) {
let target [first [creatures $self]]
if [not [isnull $target]] {
do "smile $target"
}
}
The body runs only when the room holds a creature; if first returns null
the if block is skipped (see Control flow). Note that
unless is a handler guard and takes no body — use if [not ...] for a
conditional block.
after command (say) {
let proto [object 999999]
do "say isnull=[isnull $proto]."
}
There is no object prototype with vnum 999999, so object
returns null and [isnull $proto] is true.