mirror of
https://github.com/esx-framework/esx_core.git
synced 2026-09-04 16:23:21 +00:00
Add early returns
This commit is contained in:
@@ -86,28 +86,30 @@ end
|
|||||||
|
|
||||||
local function checkValidCharacter(str)
|
local function checkValidCharacter(str)
|
||||||
for _, code in utf8.codes(str) do
|
for _, code in utf8.codes(str) do
|
||||||
|
if not (
|
||||||
|
|
||||||
local isBasicLatin = (code >= 0x0041 and code <= 0x005A) or (code >= 0x0061 and code <= 0x007A)
|
(code >= 0x0041 and code <= 0x005A) or -- Basic Latin uppercase
|
||||||
local isSpaceOrDash = (code == 0x0020 or code == 0x002D)
|
(code >= 0x0061 and code <= 0x007A) or -- Basic Latin lowercase
|
||||||
local isLatinExtended = (code >= 0x00C0 and code <= 0x02AF)
|
(code == 0x0020 or code == 0x002D) or -- Space or dash
|
||||||
local isGreek = (code >= 0x0370 and code <= 0x03FF)
|
(code >= 0x00C0 and code <= 0x02AF) or -- Latin Extended
|
||||||
local isCyrillic = (code >= 0x0400 and code <= 0x04FF)
|
(code >= 0x0370 and code <= 0x03FF) or -- Greek
|
||||||
local isHebrew = (code >= 0x05D0 and code <= 0x05EA)
|
(code >= 0x0400 and code <= 0x04FF) or -- Cyrillic
|
||||||
local isArabic =
|
(code >= 0x05D0 and code <= 0x05EA) or -- Hebrew letters
|
||||||
(code >= 0x0620 and code <= 0x063F) or
|
( -- Arabic
|
||||||
(code >= 0x0641 and code <= 0x064A) or
|
(code >= 0x0620 and code <= 0x063F) or
|
||||||
(code >= 0x066E and code <= 0x066F) or
|
(code >= 0x0641 and code <= 0x064A) or
|
||||||
(code >= 0x0671 and code <= 0x06D3) or
|
(code >= 0x066E and code <= 0x066F) or
|
||||||
(code == 0x06D5) or
|
(code >= 0x0671 and code <= 0x06D3) or
|
||||||
(code >= 0x0750 and code <= 0x077F) or
|
(code == 0x06D5) or
|
||||||
(code >= 0x08A0 and code <= 0x08BD)
|
(code >= 0x0750 and code <= 0x077F) or
|
||||||
local isCJK = (code >= 0x4E00 and code <= 0x9FFF)
|
(code >= 0x08A0 and code <= 0x08BD)
|
||||||
|
) or
|
||||||
if not (isBasicLatin or isSpaceOrDash or isLatinExtended or isGreek or isCyrillic or isHebrew or isArabic or isCJK) then
|
(code >= 0x4E00 and code <= 0x9FFF) -- CJK
|
||||||
|
)
|
||||||
|
then
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user