blob: 0c24a9288e0dcce7a19152f9fe6e2acc7bbe5a70 [file] [log] [blame]
MG Mud User88f12472016-06-24 23:31:02 +02001// MorgenGrauen MUDlib
2//
3// utils/executer.c - Helfer zum Ausfuehren vom Kram
4//
5// $Id: skills.c 6673 2008-01-05 20:57:43Z Zesstra $
6#pragma strict_types
7#pragma save_types
8#pragma range_check
9#pragma no_clone
10#pragma pedantic
11
12protected mixed execute_anything(mixed fun, varargs mixed args)
13{
14 if ( closurep(fun) && objectp(query_closure_object(fun)) )
15 return apply(fun, args);
16
17 if (stringp(fun))
18 return call_other(this_object(), fun, args...);
19
Zesstraa8592412018-12-03 22:14:12 +010020 if ( pointerp(fun))
MG Mud User88f12472016-06-24 23:31:02 +020021 {
Zesstraa8592412018-12-03 22:14:12 +010022 if (sizeof(fun) != 2)
23 raise_error(sprintf("execute_anything(): <fun> argument must "
MG Mud User88f12472016-06-24 23:31:02 +020024 "have 2 elements if array.\n"));
Zesstraa8592412018-12-03 22:14:12 +010025 object ob;
MG Mud User88f12472016-06-24 23:31:02 +020026 if ( stringp(fun[0]) )
27 ob=find_object(fun[0]);
28 else
29 ob=fun[0];
30
31 if ( !objectp(ob) || !stringp(fun[1]) )
32 return 0;
33
34 return call_other(ob, fun[1], args...);
35 }
36 return 0;
37}
38