Hello guys
I ve main.lua , file1.lua , file2.lua, result.lua linked by the storyboard function
My task is to give a variable in file1.lua (ex : local A = 1), then I skip in file2.lua and memorize another variable (ex: local B = 2 ) then skip in result.lua and here print the result of the previous variables for example print ( A+B )
How can I do??
Is there a mistake in my code?
Main.lua
display.setStatusBar(display.HiddenStatusBar) local storyboard = require("storyboard") storyboard.gotoScene("file1")
file1.lua
local storyboard = require ("storyboard") local scene = storyboard.newScene() function scene:createScene(event) local gruppo = self.view local A = 1 function skip(event) storyboard.gotoScene("file2") end Runtime:addEventListener("touch", skip) end scene:addEventListener("createScene" , scene) return scene
file2.lua
local storyboard = require ("storyboard") local scene = storyboard.newScene() function scene:createScene(event) local gruppo = self.view local B = 2 function skip(event) storyboard.gotoScene("result") end Runtime:addEventListener("touch", skip) end scene:addEventListener("createScene" , scene) return scene
result
local storyboard = require ("storyboard") local scene = storyboard.newScene() function scene:createScene(event) local gruppo = self.view print(A+B) end scene:addEventListener("createScene" , scene) return scene
But Corona gives me an error back…
Can someone gives me a tutorial about this??