/
lpctypes
48 lines (34 loc) · 1.22 KB
/
lpctypes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
CONCEPT
lpctypes
INTRODUCTION
An lpctype variable stores an LPC type like int or string*.
They are mainly used in the check_types() efun, but also for
introspection with functionlist() and variable_list().
DEFINITION
An lpctype literal can be created either by writing the type
in brackets or using the decltype(LPC) operator:
lpctype t1 = [int];
lpctype t2 = decltype(t1); /* t2 will be [lpctype] */
The type in brackets can be any type declaration, similar to
the type declarations of variable or function result.
OPERATIONS
lpctypes support the following operations:
t1 | t2
Create a union type of both types.
t1 & t2
Create the intersection of both types. If the intersection
is empty [void] will be returned.
t1 in t2
Yields 1 if t1 is a subset of t2.
EXAMPLE
void process(mixed value)
{
if (check_type(value, [int|float]))
process_number(value);
else
process_anything(value);
}
HISTORY
The type was introduced in LDMud 3.6.7.
SEE ALSO
check_type(E), decltype(LPC)