Software /
code /
prosody
Diff
util/format.lua @ 8382:e5d00bf4a4d5
util: Various minor changes to please [luacheck]
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Fri, 10 Nov 2017 05:42:32 +0100 |
parent | 8225:70cb72f46a3b |
child | 8383:d967d6f2ad00 |
line wrap: on
line diff
--- a/util/format.lua Fri Nov 10 05:34:29 2017 +0100 +++ b/util/format.lua Fri Nov 10 05:42:32 2017 +0100 @@ -8,7 +8,7 @@ local unpack = unpack; local type = type; -local function format(format, ...) +local function format(formatstring, ...) local args, args_length = { ... }, select('#', ...); -- format specifier spec: @@ -25,7 +25,7 @@ -- process each format specifier local i = 0; - format = format:gsub("%%[^cdiouxXaAeEfgGqs%%]*[cdiouxXaAeEfgGqs%%]", function(spec) + formatstring = formatstring:gsub("%%[^cdiouxXaAeEfgGqs%%]*[cdiouxXaAeEfgGqs%%]", function(spec) if spec ~= "%%" then i = i + 1; local arg = args[i]; @@ -54,10 +54,10 @@ else args[i] = tostring(arg); end - format = format .. " [%s]" + formatstring = formatstring .. " [%s]" end - return format:format(unpack(args)); + return formatstring:format(unpack(args)); end local function test()