blob: 4e0f7078e17a75eec166513b0fc2eeefc9280b40 [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
20 if ( pointerp(fun) && sizeof(fun)==2 )
21 {
22 object ob;
23 if (sizeof(fun)>2)
24 raise_error(sprintf("execute_anything(): first argument may only "
25 "have 2 elements if array.\n"));
26
27 if ( stringp(fun[0]) )
28 ob=find_object(fun[0]);
29 else
30 ob=fun[0];
31
32 if ( !objectp(ob) || !stringp(fun[1]) )
33 return 0;
34
35 return call_other(ob, fun[1], args...);
36 }
37 return 0;
38}
39