samedi 4 novembre 2017

Lua 2nd nested if statement is ignored

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

Aucun commentaire:

Enregistrer un commentaire