Validator.lua
is_ipv4 (函数)
输入
此库函数需要以下输入/参数。
- IP 地址字符串形式
- 示例: 192.168.24.10
输出
此库函数传递以下输出/参数。
- false 或 "true"
编码示例
-- Include/Call for this library require("validator") -- Check if url is a folder liboutput = validator.is_ip("192.168.24.10")
如果字符串是有效的 IP,'liboutput' 将包含字符串
true
如果字符串丢失或无效 IP,'liboutput' 将包含 false。
is_mac (函数)
输入
此库函数需要以下输入/参数。
- MAC 地址字符串形式
- 示例: 00:ca:ba:de:00:12
输出
此库函数传递以下输出/参数。
- false 或 "true"
编码示例
-- Include/Call for this library require("validator") -- Check if url is a folder liboutput = validator.is_mac("00:ca:ba:de:00:12")
如果字符串是有效的 MAC 地址,'liboutput' 将包含字符串
true
如果字符串丢失或无效 IP,'liboutput' 将包含 false。
is_integer(函数)
输入
此库函数需要以下输入/参数。
- 数字
- 示例: 100
输出
此库函数传递以下输出/参数。
- false 或 "true"
编码示例
-- Include/Call for this library require("validator") -- Check if url is a folder liboutput = validator.is_integer("100")
如果字符串是有效的 IP,'liboutput' 将包含字符串
true
如果字符串丢失或无效 IP,'liboutput' 将包含 false。
is_integer_in_range (函数)
输入
此库函数需要以下输入/参数。
- 3 个数字 --- 要测试的数字,最小值,最大值
- 示例: (10,5,12)
输出
此库函数传递以下输出/参数。
- false 或 "true"
编码示例
-- Include/Call for this library require("validator") -- Check if url is a folder liboutput = validator.is_integer_in_range(10,5,15)
如果字符串是有效的 IP,'liboutput' 将包含字符串
true
如果字符串丢失或无效 IP,'liboutput' 将包含 false。
is_port (函数)
输入
此库函数需要以下输入/参数。
- 数字 - 是否在 1 到 65535 之间
- 示例: 45
输出
此库函数传递以下输出/参数。
- false 或 "true"
编码示例
-- Include/Call for this library require("validator") -- Check if url is a folder liboutput = validator.is_port("45")
如果字符串是有效的 IP,'liboutput' 将包含字符串
true
如果字符串丢失或无效 IP,'liboutput' 将包含 false。