I am writing a tic tac toe game for my assignment, and I was stuck with the nested if statement. Attached part of my code below:
if name[1] == "AI" then
print("test string")
playerId = 1
if level == 1 or level == 2 then
print("AI lvl 1/2")
easy()
elseif level == 3 then
print("AI lvl 3")
hard()
end
elseif name[1] == "player" then
print("test string2")
Runtime:addEventListener("touch", fill)
end
while this executed, test string was printed on console, and playerId = 1, but inside 2nd if statement was completely ignored. Not even print on console. Could someone help me solve it please? Or tell me what is wrong with my code. Thanks
levelis. It sounds like it's something other than 1, 2 or 3. Where are you getting it from? If you post the code wherelevelis defined we might be able to give you some more specific help.