From 04d658d601411d0f2fb4fd4f76c390e96cd241ec Mon Sep 17 00:00:00 2001 From: rhy <81539300+rhynomatt@users.noreply.github.com> Date: Mon, 9 Jan 2023 14:01:46 -0300 Subject: [PATCH] uuid: Slightly better docs on ulid --- uuid.lua | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/uuid.lua b/uuid.lua index 13d0a26..9deeea0 100644 --- a/uuid.lua +++ b/uuid.lua @@ -29,7 +29,7 @@ function uuid.uuid4(rng) return out end --- Crockford's Base32 https://en.wikipedia.org/wiki/Base32 +-- crockford's base32 https://en.wikipedia.org/wiki/Base32 local _encoding = { "0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "A", "B", "C", "D", "E", "F", "G", "H", "J", "K", "M", @@ -60,6 +60,7 @@ local function _encode_time(time) return table.concat(out) end +--generate the random part of an ulid local function _encode_random(rng) local out = {} @@ -70,7 +71,8 @@ local function _encode_random(rng) return table.concat(out) end ---generate an ULID (see https://github.com/ulid/spec) +--generate an ULID using this rng at this time +--see https://github.com/ulid/spec --implementation based on https://github.com/Tieske/ulid.lua function uuid.ulid(rng, time_func) return _encode_time() .. _encode_random()