mirror of
https://github.com/esx-framework/esx_core.git
synced 2026-08-29 00:01:20 +00:00
fix(es_extended/server/functions): drop leading space from merge command arguments
The merge argument type computes the length of the preceding arguments plus their separators, then passes that value straight to string.sub. Lua strings are 1-indexed, so the merged text actually starts one character later and the separating space ends up at the front of the value. Tested with a command whose merge argument sits at position 1, 2 and 3: positions 2 and 3 returned " def ghi" and " ccc ddd", now they return "def ghi" and "ccc ddd". Position 1 is unaffected because string.sub clamps index 0 to 1.
This commit is contained in:
@@ -136,7 +136,7 @@ function ESX.RegisterCommand(name, group, cb, allowConsole, suggestion)
|
||||
end
|
||||
local merge = table.concat(args, " ")
|
||||
|
||||
newArgs[v.name] = string.sub(merge, length)
|
||||
newArgs[v.name] = string.sub(merge, length + 1)
|
||||
elseif v.type == "coordinate" then
|
||||
local coord = tonumber(args[k]:match("(-?%d+%.?%d*)"))
|
||||
if not coord then
|
||||
|
||||
Reference in New Issue
Block a user