mirror of
https://github.com/fusionpbx/fusionpbx.git
synced 2026-01-06 11:43:50 +00:00
Create is_uuid.lua
Add a new lua function to determine if a string is a uuid.
This commit is contained in:
13
resources/install/scripts/resources/functions/is_uuid.lua
Normal file
13
resources/install/scripts/resources/functions/is_uuid.lua
Normal file
@@ -0,0 +1,13 @@
|
||||
function is_uuid(s)
|
||||
if (string.len(s) == 36) then
|
||||
local x = "%x";
|
||||
local t = { x:rep(8), x:rep(4), x:rep(4), x:rep(4), x:rep(12) }
|
||||
local pattern = table.concat(t, '%-');
|
||||
result = s:match(pattern);
|
||||
end
|
||||
if (result == nil) then
|
||||
return false;
|
||||
else
|
||||
return true;
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user