mirror of
https://github.com/1bardesign/batteries.git
synced 2024-11-25 23:24:35 +00:00
uuid: Slight style fix
Don't need to capture the 2nd value oops, also separated the format call into multiple lines
This commit is contained in:
parent
370b33b96f
commit
3c959caa23
7
uuid.lua
7
uuid.lua
@ -19,8 +19,11 @@ local uuid4_template = "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx"
|
|||||||
function uuid.uuid4(rng)
|
function uuid.uuid4(rng)
|
||||||
-- x should be 0x0-0xF, the single y should be 0x8-0xB
|
-- x should be 0x0-0xF, the single y should be 0x8-0xB
|
||||||
-- 4 should always just be 4 (denoting uuid version)
|
-- 4 should always just be 4 (denoting uuid version)
|
||||||
local out, _ = uuid4_template:gsub("[xy]", function (c)
|
local out = uuid4_template:gsub("[xy]", function (c)
|
||||||
return string.format("%x", c == "x" and _random(rng, 0x0, 0xF) or _random(rng, 0x8, 0xB))
|
return string.format(
|
||||||
|
"%x",
|
||||||
|
c == "x" and _random(rng, 0x0, 0xF) or _random(rng, 0x8, 0xB)
|
||||||
|
)
|
||||||
end)
|
end)
|
||||||
|
|
||||||
return out
|
return out
|
||||||
|
Loading…
Reference in New Issue
Block a user