7816_error - fix number to hex conversion (thanks @vortix)

This commit is contained in:
iceman1001 2020-11-12 19:46:04 +01:00
parent 2323ff7f57
commit bd7f1c6bfb

View file

@ -71,7 +71,8 @@ _errorcodes.tostring = function(command)
return ("%s (%s)"):format(_reverse_lookup[command] or "ERROR UNDEFINED!", command) return ("%s (%s)"):format(_reverse_lookup[command] or "ERROR UNDEFINED!", command)
end end
if(type(command) == 'number') then if(type(command) == 'number') then
return ("%s (%d)"):format(_reverse_lookup[ tostring(command)] or "ERROR UNDEFINED!", command) local hx = ("%04X"):format(command)
return ("%s (0x%s)"):format(_reverse_lookup[hx] or "ERROR UNDEFINED!", hx)
end end
return ("Error, numeric or string argument expected, got : %s"):format(tostring(command)) return ("Error, numeric or string argument expected, got : %s"):format(tostring(command))
end end