diff --git a/TruckHUD.lua b/TruckHUD.lua index dcc1de4..d7cd333 100644 --- a/TruckHUD.lua +++ b/TruckHUD.lua @@ -4578,7 +4578,7 @@ script_update = { function utf8_function(utf8_func, in_encoding, out_encoding) for i = 1, #utf8_func do if _G[utf8_func[i][1]] ~= nil then - local new_function = function(...) + utf8_function_create = function(...) local pack = table.pack(...) for i = 1, pack.n do if type(pack[i]) == "string" then @@ -4593,13 +4593,14 @@ function utf8_function(utf8_func, in_encoding, out_encoding) end return table.unpack(result) end - if #utf8_func[i] == 1 then - utf8_func[i][1000] = _G[utf8_func[i][1]] - _G[utf8_func[i][1]] = new_function - else - utf8_func[i][1000] = _G[utf8_func[i][1]][utf8_func[i][2]] - _G[utf8_func[i][1]][utf8_func[i][2]] = new_function + local text = "_G" + for s = 1, #utf8_func[i] do + text = string.format('%s["%s"]', text, utf8_func[i][s]) end + text = string.format('%s = _G["utf8_function_create"];', text) + utf8_func[i][1000] = _G[utf8_func[i][1]] + load(text)() + _G["utf8_function_create"] = nil end end end