Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local kodos = {}
- function kodos.str2hex(a)
- return a:gsub(".",function(a)
- return string.format("%02x",a:byte())
- end)
- end
- function kodos.inc(a,b)
- local c = a + (b or 1)
- return c
- end
- function kodos.dec(a,b)
- local c = a - (b or 1)
- return c
- end
- function kodos.hex2str(a)
- return a:gsub("..",function(a)
- return string.char(tonumber(a,16))
- end)
- end
- function kodos.round(num, idp)
- lcoal mult = 10^(idp or 0)
- return math.floor(num * mult + 0.5) / mult
- end
- function kodos.readFile(filename)
- local file, err = io.open(filename,"rb")
- if not file then
- return nil, err
- end
- local data = file:read("*a")
- file:close()
- return data
- end
- return kodos
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement