@@ -8,111 +8,111 @@ local function typeof(cmp, arg)
88 return cmp == type (arg )
99end
1010
11- local function typeofNil (...)
11+ local function typeof_nil (...)
1212 return typeof (' nil' , ... )
1313end
1414
15- local function typeofBoolean (...)
15+ local function typeof_bool (...)
1616 return typeof (' boolean' , ... )
1717end
1818
19- local function typeofString (...)
19+ local function typeof_str (...)
2020 return typeof (' string' , ... )
2121end
2222
23- local function typeofNumber (...)
23+ local function typeof_num (...)
2424 return typeof (' number' , ... )
2525end
2626
27- local function typeofFunction (...)
27+ local function typeof_fun (...)
2828 return typeof (' function' , ... )
2929end
3030
31- local function typeofTable (...)
31+ local function typeof_table (...)
3232 return typeof (' table' , ... )
3333end
3434
35- local function typeofThread (...)
35+ local function typeof_thread (...)
3636 return typeof (' thread' , ... )
3737end
3838
39- local function typeofUserdata (...)
39+ local function typeof_userdata (...)
4040 return typeof (' userdata' , ... )
4141end
4242
43- local function typeofFinite (arg )
43+ local function typeof_finite (arg )
4444 return type (arg ) == ' number' and (arg < INFINITE_POS and arg > INFINITE_NEG )
4545end
4646
47- local function typeofUnsigned (arg )
47+ local function typeof_unsigned (arg )
4848 return type (arg ) == ' number' and (arg < INFINITE_POS and arg >= 0 )
4949end
5050
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 )
5353end
5454
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
5757end
5858
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
6161end
6262
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
6565end
6666
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 )
6969end
7070
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
7373end
7474
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
7777end
7878
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
8181end
8282
83- local function typeofNaN (arg )
83+ local function typeof_nan (arg )
8484 return arg ~= arg
8585end
8686
87- local function typeofNon (arg )
87+ local function typeof_non (arg )
8888 return arg == nil or arg == false or arg == 0 or arg == ' ' or arg ~= arg
8989end
9090
9191
9292local _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 ,
113113 -- alias
114- [' Nil' ] = typeofNil ,
115- [' Function' ] = typeofFunction
114+ [' Nil' ] = typeof_nil ,
115+ [' Function' ] = typeof_fun
116116}
117117
118118return _M
0 commit comments