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