Last edited one month ago
by Max Mustermann
No categories assignedEdit
Revision as of 11:11, 20 March 2026 by Max Mustermann (talk | contribs) (Created page with "local p = {} function p.uuid() math.randomseed(os.time() + tonumber(tostring({}):match("0x(.*)"), 16)) local template ='xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx' return string.gsub(template, '[xy]', function (c) local v = (c == 'x') and math.random(0, 0xf) or math.random(8, 0xb) return string.format('%x', v) end) end return p")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Documentation for this module may be created at Module:UUID/doc

local p = {}

function p.uuid()
    math.randomseed(os.time() + tonumber(tostring({}):match("0x(.*)"), 16))
    local template ='xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'
    return string.gsub(template, '[xy]', function (c)
        local v = (c == 'x') and math.random(0, 0xf) or math.random(8, 0xb)
        return string.format('%x', v)
    end)
end

return p