mirror of
https://github.com/mt-mods/mail.git
synced 2025-04-30 08:21:44 -04:00
Revert util/uuid.lua changes to master
This commit is contained in:
parent
c052e5900e
commit
c4ee1bd819
1 changed files with 5 additions and 7 deletions
|
@ -1,11 +1,9 @@
|
||||||
-- source: https://gist.github.com/jrus/3197011
|
-- source: https://gist.github.com/jrus/3197011
|
||||||
local random = math.random
|
local random = math.random
|
||||||
|
|
||||||
function mail.new_uuid()
|
function mail.new_uuid()
|
||||||
local template ='xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'
|
local template ='xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'
|
||||||
return string.gsub(template, '[xy]',
|
return string.gsub(template, '[xy]', function (c)
|
||||||
function (c)
|
local v = (c == 'x') and random(0, 0xf) or random(8, 0xb)
|
||||||
local v = (c == 'x') and random(0, 0xf) or random(8, 0xb)
|
return string.format('%x', v)
|
||||||
return string.format('%x', v)
|
end)
|
||||||
end)
|
end
|
||||||
end
|
|
Loading…
Add table
Reference in a new issue