Module:TableTools: Difference between revisions

From the Croc Wiki, the Croc encyclopedia
Jump to navigationJump to search
generate an error message when union and intersection functions are called with no arguments
(check type of prefix and suffix)
(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, ...)
Cookies help us deliver our services. By using our services, you agree to our use of cookies.

Navigation menu