hello I need help comparing tables
array = {}
play ={}
a = 0
function check()
a= a+1
for x =0,a do
if array[x] <= play[x] then
print (“yes”)
else
print(“no”)
end
return print(array[x])
end
end
hello I need help comparing tables
array = {}
play ={}
a = 0
function check()
a= a+1
for x =0,a do
if array[x] <= play[x] then
print (“yes”)
else
print(“no”)
end
return print(array[x])
end
end
You didn’t give me much to go on in your question, but here is one of many ways to compare values in tables…
local array = { 1, 2, 2, 3, 2, 2 } local play = { 1, 3, 2, 3, 4, 2 } local matchCount = 0 for i = 1, #array do if( array[i] == play[i] ) then print( i, “Matches” ) else print( i, “No Match”, array[i], play[i] ) end end
sorry for not formatting my code but thanks for helping me you answered my question .
You didn’t give me much to go on in your question, but here is one of many ways to compare values in tables…
local array = { 1, 2, 2, 3, 2, 2 } local play = { 1, 3, 2, 3, 4, 2 } local matchCount = 0 for i = 1, #array do if( array[i] == play[i] ) then print( i, “Matches” ) else print( i, “No Match”, array[i], play[i] ) end end
sorry for not formatting my code but thanks for helping me you answered my question .