replaced toint with a shorter version

This commit is contained in:
Izaya 2020-03-04 15:34:27 +11:00
parent a82ce51d05
commit f5262fad08

View File

@ -11,15 +11,11 @@ local function cint(n,l)
return string.reverse(string.char(table.unpack(t)):sub(1,l))
end
local function toint(s)
s=s or ""
local n = 0
local i = 1
while true do
local p = s:sub(i,i)
if p == "" then break end
local b = string.byte(p)
for p in s:gmatch(".") do
n = n << 8
n = n | b
n = n | string.byte(p)
i=i+1
end
return n