blob: 516d69b460066d283a38c512fa34d1a448abc02c [file] [log] [blame]
MG Mud User88f12472016-06-24 23:31:02 +02001SYNOPSIS
Zesstrad59c3892019-11-28 20:53:39 +01002 #include <functionlist.h>
MG Mud User88f12472016-06-24 23:31:02 +02003
Zesstrad59c3892019-11-28 20:53:39 +01004 mixed function_exists(string str)
5 mixed function_exists(string str, int flags)
Zesstra5481d492021-04-08 20:07:06 +02006 mixed function_exists(string str, object|lwobject ob)
7 mixed function_exists(string str, object|lwobject ob, int flags)
MG Mud User88f12472016-06-24 23:31:02 +02008
Zesstra715ec202025-07-09 22:18:31 +02009DESCRIPTION
10 Look up a function <str> in the current object, respectively
11 in the object <ob>. Depending on the value of <flags>, one
12 of the following informations is returned:
Zesstrad59c3892019-11-28 20:53:39 +010013
Zesstra715ec202025-07-09 22:18:31 +020014 <flags> == FEXISTS_PROGNAME (0, default):
15 Return the name of the program the function is defined in.
16 This can be either object_name(ob), or the name of an inherited
17 program. If !compat mode, the returned name always begins
18 with a '/'.
Zesstrad59c3892019-11-28 20:53:39 +010019
Zesstra715ec202025-07-09 22:18:31 +020020 <flags> == FEXISTS_FILENAME (1):
21 Return the name of the file the function is defined in (this
22 may be an include file). If !compat mode, the returned name
23 always begins with a '/'.
Zesstrad59c3892019-11-28 20:53:39 +010024
Zesstra715ec202025-07-09 22:18:31 +020025 <flags> == FEXISTS_LINENO (2):
26 Return the line number within the source file.
Zesstrad59c3892019-11-28 20:53:39 +010027
Zesstra715ec202025-07-09 22:18:31 +020028 <flags> == FEXISTS_ALL (3):
29 Return an array with all the above information, plus information
30 about the function type/flags/number of arguments.
Zesstrad59c3892019-11-28 20:53:39 +010031
Zesstra715ec202025-07-09 22:18:31 +020032 The returned array contains this information:
33 string [FEXISTS_PROGNAME]: the program name
34 string [FEXISTS_FILENAME]: the filename
35 int [FEXISTS_LINENO]: the linenumber
36 int [FEXISTS_NUMARG]: the number of arguments to the function
37 int [FEXISTS_TYPE]: the return type of the function
38 int [FEXISTS_FLAGS]: the function flags
Zesstrad59c3892019-11-28 20:53:39 +010039
Zesstra715ec202025-07-09 22:18:31 +020040 The <flags> value can be or-ed to NAME_HIDDEN to return
41 information about static and protected functions in other objects.
42 It is not possible to return information about private functions.
Zesstrad59c3892019-11-28 20:53:39 +010043
Zesstra715ec202025-07-09 22:18:31 +020044 If the function cannot be found (because it doesn't exist or
45 it is not visible to the caller), the result is 0.
Zesstrad59c3892019-11-28 20:53:39 +010046
47
Zesstra715ec202025-07-09 22:18:31 +020048EXAMPLES
49 function_exists("create")
Zesstrad59c3892019-11-28 20:53:39 +010050 function_exists("create", that_object, NAME_HIDDEN|FEXISTS_ALL);
51
Zesstra715ec202025-07-09 22:18:31 +020052HISTORY
53 LDMud 3.2.10 broadened the range of returned values and introduced
54 the <flags> argument.
55 LDMud 3.2.12/3.3.713 added the function type/flags/number of arguments
56 to the result of FEXISTS_ALL.
Zesstrad59c3892019-11-28 20:53:39 +010057
Zesstra715ec202025-07-09 22:18:31 +020058SEE ALSO
Zesstrad59c3892019-11-28 20:53:39 +010059 call_other(E), call_resolved(E), functionlist(E), variable_exists(E)