Module:IPAddress: Difference between revisions
From the Croc Wiki, the Croc encyclopedia
Jump to navigationJump to search
Content deleted Content added
clean input to remove directional markers per MediaWiki talk:Blockedtext#Not detecting IPs properly |
update from sandbox per edit request so a module can call function p._isIpOrRange(s) |
||
Line 29: | Line 29: | ||
function p._isIp(s) |
function p._isIp(s) |
||
return p._isIpV4(s) and "4" or p._isIpV6(s) and "6" |
return p._isIpV4(s) and "4" or p._isIpV6(s) and "6" |
||
⚫ | |||
function p._isIpOrRange(s) |
|||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
end |
|||
⚫ | |||
end |
end |
||
Line 46: | Line 59: | ||
function p.isIpOrRange(frame) |
function p.isIpOrRange(frame) |
||
-- {{#invoke:IPAddress|isIpOrRange|x}} → 'ip' (IPv4/IPv6) or 'range' (CIDR IPv4/IPv6) or '' (invalid) |
-- {{#invoke:IPAddress|isIpOrRange|x}} → 'ip' (IPv4/IPv6) or 'range' (CIDR IPv4/IPv6) or '' (invalid) |
||
return p._isIpOrRange(input(frame)) |
|||
⚫ | |||
local s = input(frame) |
|||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
end |
end |
||