mirror of
https://github.com/TangentFoxy/lume.git
synced 2024-12-13 17:24:21 +00:00
Changed lume.uuid() to use local math_random()
This commit is contained in:
parent
bb56f1ce3a
commit
c7471b32fb
5
lume.lua
5
lume.lua
@ -362,11 +362,10 @@ end
|
|||||||
|
|
||||||
|
|
||||||
function lume.uuid()
|
function lume.uuid()
|
||||||
local hex = "0123456789abcdef"
|
|
||||||
local fn = function(x)
|
local fn = function(x)
|
||||||
local r = math.random(16) - 1
|
local r = math_random(16) - 1
|
||||||
r = (x == "x") and (r + 1) or (r % 4) + 9
|
r = (x == "x") and (r + 1) or (r % 4) + 9
|
||||||
return hex:sub(r, r)
|
return ("0123456789abcdef"):sub(r, r)
|
||||||
end
|
end
|
||||||
return (("xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx"):gsub("[xy]", fn))
|
return (("xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx"):gsub("[xy]", fn))
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user