holster = $failed_match;
for o in (player.contents)
if (o:isa($holster))
holster = o;
break;
endif
endfor
if (holster == $failed_match)
return player:tell("You aren't wearing a holster!");
endif
...
> --
>
> You received this message because you are subscribed to the Google Groups
> "MOO Talk" group.
> To post to this group, send email to MOO-...@googlegroups.com.
> To unsubscribe from this group, send email to
> MOO-talk+u...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/MOO-talk?hl=en.
>
>
--------------------------------------------------------------------------------
No virus found in this incoming message.
Checked by AVG - www.avg.com
Version: 8.5.427 / Virus Database: 270.14.116/2578 - Release Date: 12/20/09
19:35:00
$object_utils:isa(what, parent)
Good luck:
- Daniel
No, I just wrote it like that because that's where isa belongs.
> This is not recommended, because every programmer may write his own
Nonsense.
@program #0:isa
return $object_utils:isa(this, @args);
.
> :isa() verb and returning arbitrary answers to calls. You should use the
> object utility version.
>
> $object_utils:isa(what, parent)
Except then programmers cannot override it to be isa($beverage) even without
inheriting from your $beverage.
Yes, that is a by-design feature that programmers can do that.
It is possible to 'block' that behaviour by setting the verb on root -o
or +b (a non-standard verb-flag, patches available on SourceForge).
Goblin
Both '-o' and '+b' are non-standard flags, and flawed in concept.
object:isa(parent) is for checking an object's type, not for security.
If you need a non-overridable verb, call it on a specific object, such as:
$object_utils:isa(key, $secured_parent);
But really, there is no reason to insist beverages inherit from your specific
Generic Pepsi... Even better, in fact, would be a verb dobj:can('autorecycle')
returning 1 for objects that are autorecycle-able...