Modul:TableTools: Unterschied zwischen den Versionen

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)
Zeile 49: Zeile 49:
--]]
--]]
function p.union(...)
function p.union(...)
local lim = select('#', ...)
if lim == 0 then
error("no arguments passed to 'union'", 2)
end
local ret, trackArrays = {}, {}
local ret, trackArrays = {}, {}
for i = 1, select('#', ...) do
for i = 1, lim do
local t = select(i, ...)
local t = select(i, ...)
checkType('union', i, t, 'table')
checkType('union', i, t, 'table')
Zeile 91: Zeile 95:
--]]
--]]
function p.valueUnion(...)
function p.valueUnion(...)
local lim = select('#', ...)
if lim == 0 then
error("no arguments passed to 'valueUnion'", 2)
end
local vals, ret = {}, {}
local vals, ret = {}, {}
for i = 1, select('#', ...) do
for i = 1, lim do
local t = select(i, ...)
local t = select(i, ...)
checkType('valueUnion', i, t, 'table')
checkType('valueUnion', i, t, 'table')
Zeile 122: Zeile 130:
--]]
--]]
function p.intersection(...)
function p.intersection(...)
local lim = select('#', ...)
if lim == 0 then
error("no arguments passed to 'intersection'", 2)
end
local ret, track, pairCounts = {}, {}, {}
local ret, track, pairCounts = {}, {}, {}
local lim = select('#', ...)
for i = 1, lim do
for i = 1, lim do
local t = select(i, ...)
local t = select(i, ...)
Zeile 155: Zeile 166:
--]]
--]]
function p.valueIntersection(...)
function p.valueIntersection(...)
local lim = select('#', ...)
if lim == 0 then
error("no arguments passed to 'valueIntersection'", 2)
end
local vals, ret = {}, {}
local vals, ret = {}, {}
local lim = select('#', ...)
for i = 1, lim do
for i = 1, lim do
local t = select(i, ...)
local t = select(i, ...)
Anonymer Benutzer