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)
Encodes num
number and returns string using encoder
table with base
. By default uses table which
supports base up to 62.
Decodes str
string as number using decoder
table with base
. By default uses table which supports
base up to 62.
Make encoding table from symbols
which is string or array (only single-character ASCII are supported).
Make decoding table from symbols
which is string or array (only single-character ASCII are supported).
luarocks install intconvert