Originally Posted by samyonair
At the end: In file NxUI.lua line 97 is false it has to be changed from
Lua Code:
f:AddMessage (Nx.TXTBLUE..L["Carbonite"].." |cffffffff".. (format (msg, ...) or "nil"), 1, 1, 1)
to
Lua Code:
f:AddMessage (Nx.TXTBLUE..L["Carbonite"].." |cffffffff".. format(msg, (... or "nil")), 1, 1, 1)
, because otherwise it comes to a failure if no Values are found
|
This will only work if msg requires one further argument; it only fixes a small part of the problem by brushing over the original error.
To make this more failsafe, you'd have to redesign the whole thing so the placeholder for missing arguments could be replaced by some verbose string. I'll think about it and probably come up with some solution later.
Update: here's the function:
Lua Code:
function Nx.prt (...)
local args = {...}
local i = 1
-- replace missing/erroneous placeholders
function replace_placeholders(placeholder, item)
i = i + 1
if (args[i] == nil) then
return '[missing argument]'
end
if item ~= 's' and item ~= 'q' then
if type(args[i]) == 'string' and string.match(args[i], '^[.0-9]+$') then
return placeholder
elseif type(args[i]) ~= 'number' then
return '[not a number]'
end
end
return placeholder
end
args[1] = string.gsub((args[1] or 'nil'), '(%%[0-9.]*([cdeEfgGioqsuxX]))', replace_placeholders)
local f = Nx.prtChatFrm or DEFAULT_CHAT_FRAME
f:AddMessage (Nx.TXTBLUE..L["Carbonite"].." |cffffffff".. format (unpack(args)), 1, 1, 1)
end
Pushed it to github.