diff --git a/[core]/esx_lib/imports/string/shared.lua b/[core]/esx_lib/imports/string/shared.lua index b6c00867..ba6bc456 100644 --- a/[core]/esx_lib/imports/string/shared.lua +++ b/[core]/esx_lib/imports/string/shared.lua @@ -47,7 +47,7 @@ end function xLib.string.toPascal(s) xLib.verify(s, 'string', true) - local res = s:gsub("(%a)([%w_]*)", function(first, rest) + local res = s:gsub("(%a)([%w]*)", function(first, rest) return first:upper() .. rest:lower() end):gsub("_", "") @@ -114,6 +114,10 @@ end function xLib.string.replace(s, old, new) xLib.verify(s, 'string', true) + if type(new) == "string" then + new = new:gsub("%%", "%%%%") + end + local result = s:gsub(xLib.string.escapePattern(old), new) return result diff --git a/[core]/esx_lib/imports/table/shared.lua b/[core]/esx_lib/imports/table/shared.lua index 1a590f34..37d51ee6 100644 --- a/[core]/esx_lib/imports/table/shared.lua +++ b/[core]/esx_lib/imports/table/shared.lua @@ -14,13 +14,9 @@ function xLib.table.isArray(tbl) end count, maxIndex = count + 1, math.max(maxIndex, k) - - if count > maxIndex then - return false - end end - return true + return count == maxIndex end ---@param tbl table