From 2642c304adfa5a392aef97c8f89a25e11ca0a8a6 Mon Sep 17 00:00:00 2001 From: rhy <81539300+rhynomatt@users.noreply.github.com> Date: Mon, 9 Jan 2023 12:23:11 -0300 Subject: [PATCH] uuid: Discard gsub's 2nd return value --- uuid.lua | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/uuid.lua b/uuid.lua index d341eee..18ea0a2 100644 --- a/uuid.lua +++ b/uuid.lua @@ -17,11 +17,13 @@ local uuid4_template = "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx" --generate a UUID version 4 (random) function uuid.uuid4(rng) - return uuid4_template:gsub("[xy]", function (c) - -- x should be 0x0-0xF, the single y should be 0x8-0xB - -- 4 should always just be 4 (denoting uuid version) + -- x should be 0x0-0xF, the single y should be 0x8-0xB + -- 4 should always just be 4 (denoting uuid version) + local out, _ = uuid4_template:gsub("[xy]", function (c) return string.format("%x", c == "x" and _random(rng, 0x0, 0xF) or _random(rng, 0x8, 0xB)) end) + + return out end return uuid