You are using storyboard and storyboard is a table that you can use to store scores and other things like a level counter.
Because you start every module with: local storyboard = require (“storyboard”) it is available throughout your game.
insert a table called myData into the storyboard table to use to store your score, level, lives etc…
storyboard.myData = {}
Declare the myData table at the top of your main.lua module only. Your main.lua module should start like this…
local storyboard = require (“storyboard”)
local scene = storyboard.newScene()
display.setStatusBar(display.HiddenStatusBar)
storyboard.myData = {} – Create a table to save your data to
storyboard.myData.score = 0
storyboard.myData.lives = 3
Now in each module/storyboard scene load the values from storyboard.myData, level one would start like this…
local storyboard = require (“storyboard”)
local scene = storyboard.newScene()
local score = storyboard.myData.score
local lives = storyboard.myData.lives
Use them as you like in your main chunk…
score = score +100
lives = lives - 1
When you exit the scene put the values back into the myData table to be accessed by the next level…
storyboard.myData.score = score
storyboard.myData.lives = lives
Simple as that!