blob: 50219914eb4a3e402bf0aad30c38dd9cc114fd28 [file] [log] [blame]
MG Mud User88f12472016-06-24 23:31:02 +02001SYNOPSIS
2 #include <sys/driver_hooks.h>
3
4 set_driver_hook(H_RESET, value)
5
6 <value> being:
7
8 void|int <closure> ( void )
Zesstra85136122021-05-08 20:32:01 +02009 void <name>( void )
MG Mud User88f12472016-06-24 23:31:02 +020010
11DESCRIPTION
Zesstra7ea4a032019-11-26 20:11:40 +010012 Optional hook to reset an object. Hook setting can be unbound
13 lambda closures, or the name of the function (static or public)
14 to call in the object.
MG Mud User88f12472016-06-24 23:31:02 +020015
16 If the hook is a closure, it is bound to the object to be
17 reset and called with no argument.
18
19 If the result of this call is a positive number, it is used as
Zesstra7ea4a032019-11-26 20:11:40 +010020 the interval to wait before the next reset(). If the result
MG Mud User88f12472016-06-24 23:31:02 +020021 is 0, the default interval computed from TIME_TO_RESET is
Zesstra7ea4a032019-11-26 20:11:40 +010022 used. If the result is a negative number, the object will not
MG Mud User88f12472016-06-24 23:31:02 +020023 be reset again, unless directed otherwise by set_next_reset().
24
25 If the hook is defined as the name of an lfun in the object,
Zesstra85136122021-05-08 20:32:01 +020026 it is called in the object with no argument, and any result
Zesstra7ea4a032019-11-26 20:11:40 +010027 is ignored. In this call the previous_object() is the object
28 initiating the reset. If the function does not exist, the
MG Mud User88f12472016-06-24 23:31:02 +020029 object won't be reset again.
30
31 Note that an object is only reset by call to this hook if it
32 has been used since the last reset.
33
34HISTORY
35 LDMud 3.2.10 allowed static functions to be given by name.
Zesstra85136122021-05-08 20:32:01 +020036 LDMud 3.6.5 removed the argument given for the lfun call.
MG Mud User88f12472016-06-24 23:31:02 +020037
38SEE ALSO
39 hooks(C)