I'm trying to make a scoring system that displays an all time score across every scene, when a user completes a scene the score from that scene is added to the all time score.
I get 1 error in the compiler: Attempt to perform "arithmetic" on field "score"
code from main lua: contains no errors but not sure if correct.
-- 1 Clue 1 Word
display.setStatusBar (display.HiddenStatusBar)
local storyboard = require ( "storyboard" )
storyboard.gotoScene("menu")
storyboard.state = {}
storyboard.state.score = 0
storyboard.state.score = display.newText(storyboard.state.score, 250, 20, "ARIAL", 16)
<code>
The error appears in the line: storyboard.state.score = storyboard.state.score + 1
<code>
if(correct == #L1) then
--alert()
print ("CORRECT "..#L1)
line.isVisible = false
storyboard.gotoScene( "scene2", "slideLeft", 500)
storyboard.state.score = storyboard.state.score + 1
storyboard.removeScene( "scene1" )
end
end
end