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 | |
| 16 | This hook is called whenever a call_other(), call_resolved() |
| 17 | or call_out() on named function (as opposed to a closure) |
| 18 | couldn't be resolved. The hook has then the opportunity to |
| 19 | provide a default implementation. |
| 20 | |
| 21 | Exempt from this behaviour are calls to the master object, to |
| 22 | simul-efuns, and calls done with call_direct() and |
| 23 | call_direct_resolved(). |
| 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 | |
| 39 | |
| 40 | HISTORY |
| 41 | Introduced in LDMud 3.3.113 |
| 42 | |
| 43 | SEE ALSO |
| 44 | hooks(C) |