Module:TableTools: Difference between revisions

generate an error message when union and intersection functions are called with no arguments
Enwikipedia>Mr. Stradivarius on tour
(check type of prefix and suffix)
Enwikipedia>Mr. Stradivarius
(generate an error message when union and intersection functions are called with no arguments)
Line 49:
--]]
function p.union(...)
local lim = select('#', ...)
if lim == 0 then
error("no arguments passed to 'union'", 2)
end
local ret, trackArrays = {}, {}
for i = 1, select('#', ...)lim do
local t = select(i, ...)
checkType('union', i, t, 'table')
Line 91 ⟶ 95:
--]]
function p.valueUnion(...)
local lim = select('#', ...)
if lim == 0 then
error("no arguments passed to 'valueUnion'", 2)
end
local vals, ret = {}, {}
for i = 1, select('#', ...)lim do
local t = select(i, ...)
checkType('valueUnion', i, t, 'table')
Line 122 ⟶ 130:
--]]
function p.intersection(...)
local lim = select('#', ...)
if lim == 0 then
error("no arguments passed to 'intersection'", 2)
end
local ret, track, pairCounts = {}, {}, {}
local lim = select('#', ...)
for i = 1, lim do
local t = select(i, ...)
Line 155 ⟶ 166:
--]]
function p.valueIntersection(...)
local lim = select('#', ...)
if lim == 0 then
error("no arguments passed to 'valueIntersection'", 2)
end
local vals, ret = {}, {}
local lim = select('#', ...)
for i = 1, lim do
local t = select(i, ...)