--泛型 for 的使用
table_a={
{1,4,7};
{2,5,8};
{3,5,7};
{2,4,6};
{1,8};
{3,6};
{2,7};
{4,5};
};
function isSameItem(table_1,table_2)
for i,v in pairs(table_1) do
if table_2[i] ~= v then
return false;
end
end
return true;
end
a = {1,4,7};
b = {3,5,8};
function test(t)
local flag = false;
local index = 0;
for i,v in pairs(table_a) do
if(isSameItem(t,v)) then
flag = true;
index = i;
end
end
if not flag then
print("没找到");
else
print(index.."号");
end
end
test(a);
test(b);