isobj
isobj <object>
Whether an object reference still names a live object.
This is the object-specific liveness check: it is true when the argument is an object reference whose object is still in the world, and false when that object has since been extracted (a stale reference).
The argument must actually be an object: passing null or a value of
another type is a run-time error, not a clean false. To test a value
that might be null — for example the result of first on an
empty iterable — use exists or isnull, which
accept any value.
Arguments
<object>— an object reference.
Returns
A bool — true if the reference names a live object, false if it is stale.
Examples
after command (say) {
oload 1
let item [first [inventory $self]]
do "say isobj=[isobj $item]."
}
After oload places an object (vnum 1) into the owner's
inventory, first of the inventory yields
that object, so [isobj $item] is true.
after command (say) {
let item [first [inventory $self]]
if [exists $item] {
do "say isobj=[isobj $item]."
}
}
Guard with exists first, since first may return null and
isobj errors on a null argument. When something is carried, item is a
live object and [isobj $item] is true.