Software /
code /
prosody
Diff
util/format.lua @ 12573:0f4feaf9ca64
util: Remove various Lua 5.1 compatibility hacks
Part of #1600
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Sat, 02 Jul 2022 17:31:14 +0200 |
parent | 12261:f7946c8e502f |
child | 12589:39ae08180c81 |
line wrap: on
line diff
--- a/util/format.lua Sat Jul 02 17:30:34 2022 +0200 +++ b/util/format.lua Sat Jul 02 17:31:14 2022 +0200 @@ -35,7 +35,6 @@ ["\030"] = "\226\144\158", ["\031"] = "\226\144\159", ["\127"] = "\226\144\161", }; local supports_p = pcall(string.format, "%p", ""); -- >= Lua 5.4 -local supports_a = pcall(string.format, "%a", 0.0); -- > Lua 5.1 local function format(formatstring, ...) local args = pack(...); @@ -93,8 +92,6 @@ elseif expects_positive[option] and arg < 0 then args[i] = tostring(arg); return "[%s]"; - elseif (option == "a" or option == "A") and not supports_a then - return "%x"; else return -- acceptable number end