I've been trying to print the second string in the "mode" table when I press right mouse button. But when I click the button it prints "mode: 1" instead of "mode: circle". Here is my code:
function love.load()
mode = {"square", "circle"}
currentMode = mode[1]
end
function nextMode()
currentMode = next(mode)
print(currentMode)
end
function love.draw()
love.graphics.print("mode: " .. currentMode, 10, 10)
end
function love.mousepressed(x, y, button)
if button == "r" then
nextMode()
end
end
Can someone tell me what I'm doing wrong and correct me?