MG Mud User | 88f1247 | 2016-06-24 23:31:02 +0200 | [diff] [blame] | 1 | SYNOPSIS |
| 2 | #include <sys/driver_hooks.h> |
| 3 | |
| 4 | set_driver_hook(H_DEFAULT_METHOD, value) |
| 5 | |
| 6 | <value> being: |
| 7 | |
| 8 | int <name>(mixed & result, string fun, varargs args) |
| 9 | int <closure>(mixed & result, object ob, string fun, varargs args) |
| 10 | |
| 11 | DESCRIPTION |
| 12 | Optional hook to provide default implementation for unresolved |
| 13 | calls. Hook setting can be any closure, or the name of the |
| 14 | function to call in the object. |
| 15 | |
Zesstra | 8513612 | 2021-05-08 20:32:01 +0200 | [diff] [blame] | 16 | This hook is called whenever a call_other(), call_resolved(), |
| 17 | call_strict() or call_out() on named function (as opposed to |
| 18 | a closure) couldn't be resolved. The hook has then the |
| 19 | opportunity to provide a default implementation. |
MG Mud User | 88f1247 | 2016-06-24 23:31:02 +0200 | [diff] [blame] | 20 | |
| 21 | Exempt from this behaviour are calls to the master object, to |
Zesstra | 8513612 | 2021-05-08 20:32:01 +0200 | [diff] [blame] | 22 | simul-efuns, and calls done with call_direct(), |
| 23 | call_direct_resolved() and call_strict_resolved(). |
MG Mud User | 88f1247 | 2016-06-24 23:31:02 +0200 | [diff] [blame] | 24 | |
| 25 | If the hook is the name of an lfun, it is called in the target |
| 26 | object; otherwise if it is a closure, the target object is |
| 27 | passed as parameter <ob>. |
| 28 | |
| 29 | The other parameters passed are the name <fun> of the called |
| 30 | function, the arguments <args> passed to the call (if any), |
| 31 | and a reference <result> to a variable for the call result. |
| 32 | |
| 33 | If the hook can resolve the call, it has to return the call |
| 34 | result in <result> and 1 as function result. |
| 35 | |
| 36 | If the hook can not (or doesn't want to) resolve the call, it |
| 37 | has to return 0. |
| 38 | |
MG Mud User | 88f1247 | 2016-06-24 23:31:02 +0200 | [diff] [blame] | 39 | HISTORY |
| 40 | Introduced in LDMud 3.3.113 |
| 41 | |
| 42 | SEE ALSO |
| 43 | hooks(C) |