Skip to content

iskolbin/lintconvert

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Build Status license MIT Licence

Lua integer encoder/decoder

Pure Lua integer encoder/decoder for arbitrary bases. Works with Lua 5.1+ and LuaJIT.

local intconvert = require'intconvert'
local v = 28489299
local encoded = intconvert.encode(v, 47) -- 5DiHe, default encoder supports base up to 62
local decoded = intconvert.decode(encoded, 47)
assert(v == decoded)

intconvert.encode(num, base = 10, encoder = DEFAULT)

Encodes num number and returns string using encoder table with base. By default uses table which supports base up to 62.

intconvert.decode(str, base = 10, decoder = DEFAULT)

Decodes str string as number using decoder table with base. By default uses table which supports base up to 62.

intconvert.makeencoder(symbols)

Make encoding table from symbols which is string or array (only single-character ASCII are supported).

intconvert.makedecoder(symbols)

Make decoding table from symbols which is string or array (only single-character ASCII are supported).

Install

luarocks install intconvert

About

Lua interger encoder/decoder

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages