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 | mixed funcall(closure cl, mixed arg ...) |
MG Mud User | 88f1247 | 2016-06-24 23:31:02 +0200 | [diff] [blame] | 3 | |
Zesstra | 715ec20 | 2025-07-09 22:18:31 +0200 | [diff] [blame] | 4 | DESCRIPTION |
| 5 | Evaluates the closure. The extra args will be passed as args |
| 6 | to the closure. If cl is not a closure, it will simply be |
| 7 | returned. |
MG Mud User | 88f1247 | 2016-06-24 23:31:02 +0200 | [diff] [blame] | 8 | |
Zesstra | 715ec20 | 2025-07-09 22:18:31 +0200 | [diff] [blame] | 9 | EXAMPLES |
| 10 | mixed eval(object ob, string func, mixed *args) |
| 11 | { |
| 12 | return funcall(#'call_other, ob, func, args); |
| 13 | } |
Zesstra | d59c389 | 2019-11-28 20:53:39 +0100 | [diff] [blame] | 14 | |
Zesstra | 715ec20 | 2025-07-09 22:18:31 +0200 | [diff] [blame] | 15 | This will result in calling |
| 16 | |
| 17 | ob->func(args). |
| 18 | |
| 19 | In combination with the '...' operator, the functionality |
| 20 | of apply() can be implemented: |
| 21 | |
| 22 | mixed eval(object ob, string func, mixed *args) |
| 23 | { |
| 24 | return funcall(#'call_other, ob, func, args...); |
| 25 | } |
| 26 | |
| 27 | will result in calling |
| 28 | |
| 29 | ob->func(args[0],args[1],...,args[sizeof(args)-1]). |
| 30 | |
| 31 | HISTORY |
| 32 | Introduced in 3.2@70. |
| 33 | Returning a non-closure as it is even when args are given was |
| 34 | introduced with 3.2.1. |
| 35 | |
| 36 | SEE ALSO |
MG Mud User | 88f1247 | 2016-06-24 23:31:02 +0200 | [diff] [blame] | 37 | apply(E), quote(E) |