I don’t quite understand how come when I set a variable in one file that required my module and then try to retrieve that variable in another file that I don’t get the changed variable. Here is what I mean:
--scoring.lua local scoring = {} scoring.score = 0 return scoring --file1.lua local scoring = require("scoring") local scoreDisplay = display.newText("", irrelevant) function AddPoint() scoring.score = scoring.score + 1 scoreDisplay.text = scoring.score end --file2.lua local scoring = require("scoring") --This scene is for when the game is over and the score has been changed alot function scene:enterScene(event) print(scoring.score) --PRINTS 0 !!! Even though the score is not end
Is there something obvious I’m not seeing?