Postado Novembro 23, 2014 10 anos [LUA Function] table.compare(table1, table2) função: ela verifica se as 2 tabelas, são exatamente iguais. Código: function table.compare(table1, table2) local n = 0 local maxn = 0 if #table1 == #table2 then maxn = #table1 else return false end for i = 1, #table1 do for s = 1, #table2 do if table1[i] == table2[s] then n = n + 1 end end end if n == maxn then return true end return false end Exemplo: if table.compare({1, 2}, {1, 2}) then print(true) else print(false) end Tony Araújo
Participe da conversa
Você pode postar agora e se cadastrar mais tarde. Se você tem uma conta, faça o login para postar com sua conta.