Morgengrauner Dokumentation
Dateipfad: /home/mud/mudlib/doc//efun/get_type_infoSYNOPSIS
mixed get_type_info(mixed arg)
mixed get_type_info(mixed arg, int flag)
DESCRIPTION
Returns info about the type of arg, as controlled by the flag.
If the optional argument is not given, an array is
returned whose first element is an integer denoting the data
type, as defined in . The second entry can contain
additional information about arg.
If flag is the number 0, only the first element of that array
(i.e. the data type) is returned (as int). If is 1, the
second element is returned.
If is a closure or coroutine, the setting 2 lets the
efun return the object of the closure resp. coroutine (which for
'lfun closures' is the object the lfun is defined in, which is not
necessarily the object the closure is bound to).
If is a struct, the setting 2 lets the efun
return the base name of the struct.
If is a lfun, context closure or coroutine, the
setting 3 lets the efun return the name of the program the closure
resp. coroutine was defined in. For other closures,
setting 3 returns 0.
If is a lfun, context closure or coroutine, the
setting 4 lets the efun return the name of the function.
For other closures, setting 4 returns 0.
For every other setting, -1 is returned.
The secondary information is:
- for mappings the width, ie the number of data items per key.
- for symbols and quoted arrays the number of quotes.
- for closures, the (internal) closure type, as defined in
.
- for strings 0 for shared strings, and non-0 for others.
- for structs the unique identifier string.
- for Python objects the name of the type.
- -1 for all other datatypes.
BUGS
This function seems to be due to frequent changes as the
driver develops resp. is debugged.
HISTORY
Introduced in 3.2@127
Flag setting 2 was introduced in 3.2.1@84.
Secondary string information was introduced in 3.2.7.
Up to 3.2.7 inclusive, get_type_info(closure,2) did not return
the object from a lambda closure or bound-lambda closure.
In the 3.2 branch, the 'flag' argument could be of any type.
LDMud 3.3.276 added the secondary information for structs.
LDMud 3.3.548 added flag setting '3' for lfun/context closures.
LDMud 3.3.708 added flag setting '4' for lfun/context closures.
SEE ALSO
debug_info(E), typeof(E), to_object(E), check_type(E)
zurück zur Übersicht