I have a question please.
I did similar as Jensto wrote above.
It works fine when level1 goes to level2. Images and variable are successfully loaded.
My problem is i cant’ go back to level1. It always show images from level2.lua.
I think the value of the last loaded lua is saved in package.loaded, so it wont load the level1.lua for the second time.
So how can i reload those images from level1.lua ?
This is part of my game.lua
[lua]
function scene:createScene( event )
Level = nil
local loadLvl = “level”…_myGlobal.lvl-- myGlobal.lvl save the value of level (1, 2, 3, and so on)
Level = require(loadLvl)
thisLvl = Level:new()
end
scene:addEventListener( “createScene”, scene )
[/lua]
Did i miss something?