@@ -8,111 +8,111 @@ local function typeof(cmp, arg)
8
8
return cmp == type (arg )
9
9
end
10
10
11
- local function typeofNil (...)
11
+ local function typeof_nil (...)
12
12
return typeof (' nil' , ... )
13
13
end
14
14
15
- local function typeofBoolean (...)
15
+ local function typeof_bool (...)
16
16
return typeof (' boolean' , ... )
17
17
end
18
18
19
- local function typeofString (...)
19
+ local function typeof_str (...)
20
20
return typeof (' string' , ... )
21
21
end
22
22
23
- local function typeofNumber (...)
23
+ local function typeof_num (...)
24
24
return typeof (' number' , ... )
25
25
end
26
26
27
- local function typeofFunction (...)
27
+ local function typeof_fun (...)
28
28
return typeof (' function' , ... )
29
29
end
30
30
31
- local function typeofTable (...)
31
+ local function typeof_table (...)
32
32
return typeof (' table' , ... )
33
33
end
34
34
35
- local function typeofThread (...)
35
+ local function typeof_thread (...)
36
36
return typeof (' thread' , ... )
37
37
end
38
38
39
- local function typeofUserdata (...)
39
+ local function typeof_userdata (...)
40
40
return typeof (' userdata' , ... )
41
41
end
42
42
43
- local function typeofFinite (arg )
43
+ local function typeof_finite (arg )
44
44
return type (arg ) == ' number' and (arg < INFINITE_POS and arg > INFINITE_NEG )
45
45
end
46
46
47
- local function typeofUnsigned (arg )
47
+ local function typeof_unsigned (arg )
48
48
return type (arg ) == ' number' and (arg < INFINITE_POS and arg >= 0 )
49
49
end
50
50
51
- local function typeofInt (arg )
52
- return typeofFinite (arg ) and rawequal (floor (arg ), arg )
51
+ local function typeof_int (arg )
52
+ return typeof_finite (arg ) and rawequal (floor (arg ), arg )
53
53
end
54
54
55
- local function typeofInt8 (arg )
56
- return typeofInt (arg ) and arg >= - 128 and arg <= 127
55
+ local function typeof_int8 (arg )
56
+ return typeof_int (arg ) and arg >= - 128 and arg <= 127
57
57
end
58
58
59
- local function typeofInt16 (arg )
60
- return typeofInt (arg ) and arg >= - 32768 and arg <= 32767
59
+ local function typeof_int16 (arg )
60
+ return typeof_int (arg ) and arg >= - 32768 and arg <= 32767
61
61
end
62
62
63
- local function typeofInt32 (arg )
64
- return typeofInt (arg ) and arg >= - 2147483648 and arg <= 2147483647
63
+ local function typeof_int32 (arg )
64
+ return typeof_int (arg ) and arg >= - 2147483648 and arg <= 2147483647
65
65
end
66
66
67
- local function typeofUInt (arg )
68
- return typeofUnsigned (arg ) and rawequal (floor (arg ), arg )
67
+ local function typeof_uint (arg )
68
+ return typeof_unsigned (arg ) and rawequal (floor (arg ), arg )
69
69
end
70
70
71
- local function typeofUInt8 (arg )
72
- return typeofUInt (arg ) and arg <= 255
71
+ local function typeof_uint8 (arg )
72
+ return typeof_uint (arg ) and arg <= 255
73
73
end
74
74
75
- local function typeofUInt16 (arg )
76
- return typeofUInt (arg ) and arg <= 65535
75
+ local function typeof_uint16 (arg )
76
+ return typeof_uint (arg ) and arg <= 65535
77
77
end
78
78
79
- local function typeofUInt32 (arg )
80
- return typeofUInt (arg ) and arg <= 4294967295
79
+ local function typeof_uint32 (arg )
80
+ return typeof_uint (arg ) and arg <= 4294967295
81
81
end
82
82
83
- local function typeofNaN (arg )
83
+ local function typeof_nan (arg )
84
84
return arg ~= arg
85
85
end
86
86
87
- local function typeofNon (arg )
87
+ local function typeof_non (arg )
88
88
return arg == nil or arg == false or arg == 0 or arg == ' ' or arg ~= arg
89
89
end
90
90
91
91
92
92
local _M = {
93
- [' nil' ] = typeofNil ,
94
- [' boolean' ] = typeofBoolean ,
95
- [' string' ] = typeofString ,
96
- [' number' ] = typeofNumber ,
97
- [' function' ] = typeofFunction ,
98
- [' table' ] = typeofTable ,
99
- [' thread' ] = typeofThread ,
100
- [' userdata' ] = typeofUserdata ,
101
- [' finite' ] = typeofFinite ,
102
- [' unsigned' ] = typeofUnsigned ,
103
- [' int' ] = typeofInt ,
104
- [' int8' ] = typeofInt8 ,
105
- [' int16' ] = typeofInt16 ,
106
- [' int32' ] = typeofInt32 ,
107
- [' uint' ] = typeofUInt ,
108
- [' uint8' ] = typeofUInt8 ,
109
- [' uint16' ] = typeofUInt16 ,
110
- [' uint32' ] = typeofUInt32 ,
111
- [' nan' ] = typeofNaN ,
112
- [' non' ] = typeofNon ,
93
+ [' nil' ] = typeof_nil ,
94
+ [' boolean' ] = typeof_bool ,
95
+ [' string' ] = typeof_str ,
96
+ [' number' ] = typeof_num ,
97
+ [' function' ] = typeof_fun ,
98
+ [' table' ] = typeof_table ,
99
+ [' thread' ] = typeof_thread ,
100
+ [' userdata' ] = typeof_userdata ,
101
+ [' finite' ] = typeof_finite ,
102
+ [' unsigned' ] = typeof_unsigned ,
103
+ [' int' ] = typeof_int ,
104
+ [' int8' ] = typeof_int8 ,
105
+ [' int16' ] = typeof_int16 ,
106
+ [' int32' ] = typeof_int32 ,
107
+ [' uint' ] = typeof_uint ,
108
+ [' uint8' ] = typeof_uint8 ,
109
+ [' uint16' ] = typeof_uint16 ,
110
+ [' uint32' ] = typeof_uint32 ,
111
+ [' nan' ] = typeof_nan ,
112
+ [' non' ] = typeof_non ,
113
113
-- alias
114
- [' Nil' ] = typeofNil ,
115
- [' Function' ] = typeofFunction
114
+ [' Nil' ] = typeof_nil ,
115
+ [' Function' ] = typeof_fun
116
116
}
117
117
118
118
return _M
0 commit comments