Update doc/efun/ aus Driversourcen.
Manpages der efuns aktualisiert, neue Manpages hinzugefuegt.
Change-Id: I7cc91684269ff56d1aef47d5c5e7c87f7fd531dc
diff --git a/doc/efun/apply b/doc/efun/apply
index d7c891e..0a8002e 100644
--- a/doc/efun/apply
+++ b/doc/efun/apply
@@ -1,35 +1,49 @@
SYNOPSIS
- mixed apply(closure cl, mixed arg, ...)
+ mixed apply(closure cl, ...)
-BESCHREIBUNG
- Wertet die Closure <cl> aus. Wenn <cl> keine Closure ist, wird <cl>
- unveraendert zurueck geliefert und alle Argumente <arg> werden
- ignoriert.
+DESCRIPTION
+ Evaluates the closure <cl> with the following arguments.
+ If the last argument is an array or struct, it will be
+ flattened: ie. the array/struct itself will be removed and its
+ contents added to the argument list of <cl>
- Es gibt einen kleinen Unterschied zu funcall(), das ja im Wesentlichen
- das gleiche tut (naemlich, eine Closure auswerten): wenn das letzte
- Argument von apply() ein Array ist, wird jedes Element dieses Arrays
- zu einem separaten zusaetzlichen Parameter der Closure umgewandelt.
+ If <cl> is not a closure, it will simply be returned (and all
+ other arguments are ignored).
- Eine moegliche Anwendung waere:
- mixed eval(object ob,string func,mixed *args)
- {
- return apply(#'call_other,ob,func,args);
- }
+EXAMPLES
+ The flattening of the last argument is the important difference
+ between apply() and funcall(). For example:
- Das fuehrt zu folgenden Aufrufen:
- ob->func(args[0],args[1],...,args[sizeof(args)-1])
+ mixed eval(object ob, string func, mixed *args)
+ {
+ return apply(#'call_other, ob, func, args);
+ }
- Waere stattdessen funcall() aufgerufen worden, so haette das ergeben:
- ob->func(args)
+ This will result in calling
- Eine wichtige Anwendung von apply() ist das Auswerten des
- Array-Arguments in "varargs" Funktionen.
+ ob->func(args[0],args[1],...,args[sizeof(args)-1]).
-GESCHICHTE
- Eingefuehrt in 3.2@70.
- LDMud 3.2.8 fuehrte ein, dass das erste Argument zurueck gegeben wird,
- wenn es sich nicht um eine Closure handelt.
+ Using funcall() instead of apply() would have given us
-SIEHE AUCH
+ ob->func(args).
+
+
+ Of course, with the '...' operator we could also write
+
+ mixed eval(object ob, string func, mixed *args)
+ {
+ return funcall(#'call_other, ob, func, args...);
+ }
+
+ and achieve the same result.
+
+HISTORY
+ Introduced in 3.2@70
+ LDMud 3.2.8 adds the returning of a non-closure as first
+ argument.
+ LDMud 3.3 added the '...' operator and thus made apply() in fact
+ redundant.
+ LDMud 3.3.266 added support for structs.
+
+SEE ALSO
funcall(E), closures(LPC), varargs(LPC)