Comparison

util/format.lua @ 11646:b6ea0148ad37

util.format: Fix missing backslash in pattern Made the pattern match a longer range than intended, but with no effect since those characters are not present in the 'control_symbols' table.
author Kim Alvefur <zash@zash.se>
date Sat, 03 Jul 2021 04:24:13 +0200
parent 11644:fc1b8fe94d04
child 11647:0fe6a9a3676f
comparison
equal deleted inserted replaced
11645:3be346c5b940 11646:b6ea0148ad37
58 spec = "(%s)"; 58 spec = "(%s)";
59 elseif option == "q" then 59 elseif option == "q" then
60 args[i] = dump(arg); 60 args[i] = dump(arg);
61 spec = "%s"; 61 spec = "%s";
62 elseif option == "s" then 62 elseif option == "s" then
63 args[i] = tostring(arg):gsub("[%z\1-31\127]", control_symbols); 63 args[i] = tostring(arg):gsub("[%z\1-\31\127]", control_symbols);
64 elseif type(arg) ~= "number" then -- arg isn't number as expected? 64 elseif type(arg) ~= "number" then -- arg isn't number as expected?
65 args[i] = tostring(arg); 65 args[i] = tostring(arg);
66 spec = "[%s]"; 66 spec = "[%s]";
67 elseif expects_integer[option] and num_type(arg) ~= "integer" then 67 elseif expects_integer[option] and num_type(arg) ~= "integer" then
68 args[i] = tostring(arg); 68 args[i] = tostring(arg);