MG Mud User | 88f1247 | 2016-06-24 23:31:02 +0200 | [diff] [blame] | 1 | SYNOPSIS |
Zesstra | 715ec20 | 2025-07-09 22:18:31 +0200 | [diff] [blame^] | 2 | int call_resolved(mixed result, object ob, string func, ...) |
| 3 | int* call_resolved(mixed* result, object* ob, string func, ...) |
MG Mud User | 88f1247 | 2016-06-24 23:31:02 +0200 | [diff] [blame] | 4 | |
Zesstra | 715ec20 | 2025-07-09 22:18:31 +0200 | [diff] [blame^] | 5 | DESCRIPTION |
| 6 | Similar to call_other(). If ob->func() is defined and publicly |
| 7 | accessible, any of the optional extra arguments are passed to |
| 8 | ob->func(...). The result of that function call is stored in |
| 9 | result, which must be passed by reference. |
MG Mud User | 88f1247 | 2016-06-24 23:31:02 +0200 | [diff] [blame] | 10 | |
Zesstra | 715ec20 | 2025-07-09 22:18:31 +0200 | [diff] [blame^] | 11 | The efun returns 1 if the function could be called. |
| 12 | If ob::fun does not define a publicly accessible function, the |
| 13 | efun will call the H_DEFAULT_METHOD hook if set. If the hook |
| 14 | is not set or can't resolve the call either, the efun will return 0. |
| 15 | If the hook is set and can resolve the call, the efun will return -1. |
MG Mud User | 88f1247 | 2016-06-24 23:31:02 +0200 | [diff] [blame] | 16 | |
Zesstra | 715ec20 | 2025-07-09 22:18:31 +0200 | [diff] [blame^] | 17 | Calls to the master object never use the H_DEFAULT_METHOD hook. |
| 18 | To force non-default calls, the efun call_direct_resolved() can |
| 19 | be used. |
MG Mud User | 88f1247 | 2016-06-24 23:31:02 +0200 | [diff] [blame] | 20 | |
Zesstra | 715ec20 | 2025-07-09 22:18:31 +0200 | [diff] [blame^] | 21 | ob can also be an object_name. If a string is passed for ob |
| 22 | and an object with that name can't be found or loaded, an |
| 23 | error occurs. |
Zesstra | 5481d49 | 2021-04-08 20:07:06 +0200 | [diff] [blame] | 24 | |
Zesstra | 715ec20 | 2025-07-09 22:18:31 +0200 | [diff] [blame^] | 25 | Additionally the efun accepts an array of objects as <ob>: the |
| 26 | function is called with the same arguments in all the given objects. |
| 27 | The single results are collected in two arrays, one for the result |
| 28 | of the function calls that will be stored in the result parameter, |
| 29 | and one for the efun result codes that will finally be returned from |
| 30 | the efun. Array elements can be objects or the names of existing |
| 31 | objects; destructed objects and 0s will yield a '0' as result in |
| 32 | both arrays, but don't cause an error. |
Zesstra | 5481d49 | 2021-04-08 20:07:06 +0200 | [diff] [blame] | 33 | |
Zesstra | 715ec20 | 2025-07-09 22:18:31 +0200 | [diff] [blame^] | 34 | HISTORY |
| 35 | LDMud 3.3.113 introduced the H_DEFAULT_METHOD hook. |
| 36 | LDMud 3.6.2 added array calls. |
| 37 | |
| 38 | SEE ALSO |
Zesstra | 5481d49 | 2021-04-08 20:07:06 +0200 | [diff] [blame] | 39 | call_other(E), call_strict(E), call_direct(E), call_direct_strict(E), |
| 40 | call_direct_resolved(E), create(A), pragma(LPC), extern_call(E), |
| 41 | function_exists(E), functions(LPC), map_objects(E) |