version '0.0.7'

This commit is contained in:
MrNewb committed 2025-01-08 06:33:31 -05:00
1 parent 89a9a371bd
commit 47977ce701
105 files changed
+5036 -1

No files matched your search

+22
View File
@@ -0,0 +1,22 @@
Ids = {}
function Ids.CreateUniqueId(tbl, len, pattern) -- both optional
tbl = tbl or {} -- table to check uniqueness. Ids to check against must be the key to the tables value
len = len or 8
local id = ""
for i = 1, len do
local char = ""
if pattern then
char = pattern:sub(math.random(1, #pattern), math.random(1, #pattern))
else
char = math.random(1, 2) == 1 and string.char(math.random(65, 90)) or math.random(0, 9) -- CAP letter and number
end
id = id .. char
end
if tbl[id] then
return Ids.CreateUniqueId(tbl, len, pattern)
end
return id
end
return Ids