lua-cs-bouncer-mcaptcha/lib/utils.lua
2020-10-07 16:49:14 +02:00

8 lines
No EOL
205 B
Lua

function _M.ipToInt( str )
local num = 0
if str and type(str)=="string" then
local o1,o2,o3,o4 = str:match("(%d+)%.(%d+)%.(%d+)%.(%d+)" )
num = 2^24*o1 + 2^16*o2 + 2^8*o3 + o4
end
return num
end