mirror of
https://github.com/ldmud/ldmud
synced 2026-08-12 14:26:05 -04:00
These efuns are similar to call_resolved() and call_direct_resolved(), but they raise a runtime error if the called function does not exist.
43 lines
1.5 KiB
Text
43 lines
1.5 KiB
Text
SYNOPSIS
|
|
#include <sys/driver_hooks.h>
|
|
|
|
set_driver_hook(H_DEFAULT_METHOD, value)
|
|
|
|
<value> being:
|
|
|
|
int <name>(mixed & result, string fun, varargs args)
|
|
int <closure>(mixed & result, object ob, string fun, varargs args)
|
|
|
|
DESCRIPTION
|
|
Optional hook to provide default implementation for unresolved
|
|
calls. Hook setting can be any closure, or the name of the
|
|
function to call in the object.
|
|
|
|
This hook is called whenever a call_other(), call_resolved(),
|
|
call_strict() or call_out() on named function (as opposed to
|
|
a closure) couldn't be resolved. The hook has then the
|
|
opportunity to provide a default implementation.
|
|
|
|
Exempt from this behaviour are calls to the master object, to
|
|
simul-efuns, and calls done with call_direct(),
|
|
call_direct_resolved() and call_strict_resolved().
|
|
|
|
If the hook is the name of an lfun, it is called in the target
|
|
object; otherwise if it is a closure, the target object is
|
|
passed as parameter <ob>.
|
|
|
|
The other parameters passed are the name <fun> of the called
|
|
function, the arguments <args> passed to the call (if any),
|
|
and a reference <result> to a variable for the call result.
|
|
|
|
If the hook can resolve the call, it has to return the call
|
|
result in <result> and 1 as function result.
|
|
|
|
If the hook can not (or doesn't want to) resolve the call, it
|
|
has to return 0.
|
|
|
|
HISTORY
|
|
Introduced in LDMud 3.3.113
|
|
|
|
SEE ALSO
|
|
hooks(C)
|