Changeset

9687:8c92ef4270c9

util.format: Use pack from util.table
author Kim Alvefur <zash@zash.se>
date Sat, 08 Dec 2018 16:35:39 +0100
parents 9686:e52e4e6e7ffb
children 9688:eade1316728e
files util/format.lua
diffstat 1 files changed, 3 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/util/format.lua	Sat Dec 08 16:35:00 2018 +0100
+++ b/util/format.lua	Sat Dec 08 16:35:39 2018 +0100
@@ -3,12 +3,13 @@
 --
 
 local tostring = tostring;
-local select = select;
 local unpack = table.unpack or unpack; -- luacheck: ignore 113/unpack
+local pack = require "util.table".pack; -- TODO table.pack in 5.2+
 local type = type;
 
 local function format(formatstring, ...)
-	local args, args_length = { ... }, select('#', ...);
+	local args = pack(...);
+	local args_length = args.n;
 
 	-- format specifier spec:
 	-- 1. Start: '%%'