私はこのテーブルを持っています:
no_table ={
{a="3", b="22", c="18", d="ABC"},
{a="4", b="12", c="25", d="ABC"},
{a="5", b="15", c="16", d="CDE"},
}
この関数:
function testfoo()
i = 1
while no_table[i] ~= nil do
foo(no_table[i])
i = i + 1
end
end
およびfoo関数:
function foo(a,b,c,d)
if no_table[i][4] ~= no_table[i-1][4]
then
print (a+b)
elseif no_table[i][4] == no_table[i-1][4]
then
print (b+c)
end
end
見つけるのを手伝ってくれませんか。:
2つのテーブルが等しいかどうかを確認できる方法(現在、nilにインデックスを付けることはできません)
等式が真の場合は「print(b + c)」コードのみを実行する方法、または真でない場合は、コードを複製せずに最初に「print(a + b)」と2番目に「print(b + c)」の両方を実行する方法。