I am giving the player 5 game lives that will be auto replaced 30 minutes after they were used.
I set up a game time table module as follows;
local gameTimeT={ } – create a table to store game livesgameTimeT[“gameTime1”] = 1
gameTimeT[“gameTime2”] = 1
gameTimeT[“gameTime3”] = 1
gameTimeT[“gameTime4”] = 1
gameTimeT[“gameTime5”] = 1
When the player presses the End Game button, I load the saved number of game lives and the saved number for game times 1 through game times 5.
Next I deduct one from game lives, set and save. Appears to be working properly.
When the end button is pressed, I set the time as last move = os.time(). Then when I try to save the time to the table for one of the 5 game times, it overwrite game times 1 -5 with the time for last move. So I tried setting the last move for one game time and then resave the time previously loaded for the other four. The print on the terminal reflects the correct times being saved to the table.
After that I go to an “end game” temp screen that I used to remove all of the scenes and then takes the player to the level tracker screen (this is the screen where the player can select which available level they want to play.
In scene show, I loaded the game lives and game times stored in the table. It shows a 1 for all five of the game times (one means it is basically not used). I’m confused because when I was updating the table at the end game button, it appeared to be saving the data correctly.
I’m confused and frustrated. I’m not sure how to resolve this and would greatly appreciate any suggestions.
Thanks,
Lori