forked from livecode/livecode
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathis-a.lcdoc
More file actions
99 lines (72 loc) · 3.16 KB
/
Copy pathis-a.lcdoc
File metadata and controls
99 lines (72 loc) · 3.16 KB
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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
Name: is a
Synonyms: is an
Type: operator
Syntax: <value> is a[n] {array | boolean | color | date | integer | number | point | rect | ASCII string }
Summary:
<evaluate|Evaluates> to true if a <value> is of the specified type,
false otherwise.
Introduced: 1.0
OS: mac, windows, linux, ios, android
Platforms: desktop, server, mobile
Example:
"1/16/98" is a date -- evaluates to true
Example:
1 is a boolean -- evaluates to false
Example:
45.4 is an integer -- evaluates to false
Example:
"red" is a color -- evaluates to true
Example:
local tArray
put "test" into tArray[1]
put tArray is an array -- evaluates to true
Example:
numToChar(128) is an ASCII string -- evaluates to false
Parameters:
value:
Any source of <value>.
Description:
Use the <is a> <operator> to <validate> data to make sure it's the right
type.
This operator is useful for checking whether the user has entered data
correctly, and for checking parameters before sending them to a handler
to avoid a script error caused by feeding data of one type to an
operator or function that requires a different type.
A <value> is a(n):
* <array(keyword)> if its <keys> function is not empty.
* <boolean> or <logical> if it is one of the two constants true or false
* color if it is a valid <color reference>
* date if it is in one of the formats produced by the <date> or <time>
functions
* <integer(keyword)> if it consists of digits (with an optional leading
minus sign), or an hexadecimal number (such as 0x0F9B)
* number if it consists of digits, optional leading minus sign, optional
decimal point, and optional "E" or "e" (scientific notation), or an
optional leading minus sign and infinity or inf
* <point> if it consists of two numbers separated by a comma
* <rectangle|rect> if it consists of four numbers separated by commas
* <ASCII> string if it does not contain any characters greater than
charToNum(127)
All the types other than boolean can also include leading or trailing
white space characters.
>*Note:* To ensure compatibility with SuperCard stacks, the is a color
> operator returns true for any integer, although integers
are not valid colors in LiveCode. If you need to strictly verify a color
then you can write a wrapper function to do so that checks that the
color is not an integer.
>*Note:* The range of dates that LiveCode can handle is limited by the
> operating system's date routines. In particular, Windows
systems are limited to dates after 1/1/1970. This means that the is a
date operator will return false for dates before 1/1/1970 on Windows.
The <is a> <operator> is the <logical> <inverse> of the <is not a>
<operator>. When one is true, the other is false.
Changes:
The <is an> <array(keyword)> form was added in version 2.9
References: convert (command), colorNames (function), date (function),
isNumber (function), keys (function), time (function), array (glossary),
ASCII (glossary), boolean (glossary), color reference (glossary),
evaluate (glossary), integer (glossary), inverse (glossary),
logical (glossary), operator (glossary), string (glossary),
validate (glossary), value (glossary), array (keyword), integer (keyword),
point (keyword), rectangle (keyword), is not a (operator)
Tags: math