mirror of
https://github.com/mt-mods/mail.git
synced 2025-04-30 08:21:44 -04:00
The risk is ridiculous compared to the performance lost, even for several millions of messages.
11 lines
321 B
Lua
11 lines
321 B
Lua
-- source: https://gist.github.com/jrus/3197011
|
|
local random = math.random
|
|
|
|
function mail.new_uuid()
|
|
local template ='xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'
|
|
return string.gsub(template, '[xy]',
|
|
function (c)
|
|
local v = (c == 'x') and random(0, 0xf) or random(8, 0xb)
|
|
return string.format('%x', v)
|
|
end)
|
|
end
|