mirror of
https://github.com/ldmud/ldmud
synced 2026-08-12 14:26:05 -04:00
Driver hooks that accepted lfun closures before can now handle any type of closure. Also the H_CREATE_* hooks can now handle any type of closure.
42 lines
1.5 KiB
Text
42 lines
1.5 KiB
Text
SYNOPSIS
|
|
#include <sys/driver_hooks.h>
|
|
|
|
set_driver_hook(H_RESET, value)
|
|
|
|
<value> being:
|
|
|
|
void <name>( void )
|
|
void|int <closure> ( void )
|
|
void|int <closure> (object obj_to_reset)
|
|
|
|
DESCRIPTION
|
|
Optional hook to reset an object. Hook setting can be any
|
|
closure, or the name of the function (static or public) to
|
|
call in the object.
|
|
|
|
If the hook is an unbound lambda closure, it is bound to the
|
|
object to be reset and called with no argument. If the hook
|
|
is any other type of closure, it is called with the target
|
|
object as argument.
|
|
|
|
If the result of this call is a positive number, it is used as
|
|
the interval to wait before the next reset(). If the result
|
|
is 0, the default interval computed from TIME_TO_RESET is
|
|
used. If the result is a negative number, the object will not
|
|
be reset again, unless directed otherwise by set_next_reset().
|
|
|
|
If the hook is defined as the name of an lfun in the object,
|
|
it is called in the object with no argument, and any result
|
|
is ignored. In this call the previous_object() is the object
|
|
initiating the reset. If the function does not exist, the
|
|
object won't be reset again.
|
|
|
|
Note that an object is only reset by call to this hook if it
|
|
has been used since the last reset.
|
|
|
|
HISTORY
|
|
LDMud 3.2.10 allowed static functions to be given by name.
|
|
LDMud 3.6.5 removed the argument given for the lfun call.
|
|
|
|
SEE ALSO
|
|
hooks(C)
|