Help with director class please

OK so i am making screen transitions and whenever i start my app in the simulator it completely skips the menu.lua screen and i cant figure out why, there are no errors in the terminal.

Here are the following .lua files i have:
main.lua
menu.lua
director.lua
Here is the code in the menu.lua:

module(..., package.seeall);  
  
function new()  
 local Scene = display.newGroup();  
  
 local GUI = display.newGroup()  
  
 local bg\_frame = display.newImage("tree1.jpg");  
 local bg\_knockout = display.newImage("tree1.jpg");  
 local bg\_rect = display.newRect(0, 0, \_W, \_H);  
  
 bg\_rect.x = \_W \* 0.5; bg\_rect.y = \_H \* 0.5;  
 bg\_rect:setFillColor(100, 100, 100);  
  
 GUI:insert(bg\_rect);  
 GUI:insert(bg\_knockout);  
 GUI:insert(bg\_frame);  
  
 local title = display.newText("X-Mas Countdown Timer", 0, 0, "Times New Roman", 72)  
 title.x = \_W \* 0.5; title.y = (\_H \* 0.5) - 120;  
  
 local go\_btn = display.newText("GO", 0, 0, "Times New Roman", 48)  
 go\_btn.x = \_W \* 0.5; go\_btn.y = (\_H \* 0.5) + 120;  
 go\_btn.scene = "menu";  
  
 GUI:insert(title);  
 GUI:insert(go\_btn);  
  
 local function changeScene(e)  
 if(e.phase == "ended" or e.phase == "cancelled") then  
 director:changeScene(e.target.scene);  
 end  
 end  
  
 go\_btn:addEventListener("touch", changeScene);  
  
 Scene:insert(GUI);  
  
 return Scene  
end  

And here is the code that goes with this and the director class in the main.lua file:

local director = require("director")  
  
local mainGroup = display.newGroup();  
  
local function main()  
  
 director:changeScene("menu");  
  
 return true;  
end  
  
main();  

And like i said it just skips the menu.lua screen and goes straight to the main.lua file and i cant figure out why :confused: [import]uid: 69054 topic_id: 18740 reply_id: 318740[/import]

main.lua is the first file to be ran.

So it should go main.lua -> menu.lua? [import]uid: 46343 topic_id: 18740 reply_id: 72082[/import]

Hmm yea i guess but how would i make it load menu.lua first then click a button and it go to main.lua? [import]uid: 69054 topic_id: 18740 reply_id: 72083[/import]

You can’t, you need to think of it as this.

The iPhone loads main.lua from there you go onto others.

So main.lua would need to be the entry point, then it proceeds onto menu.lua then onto game.lua (or what ever). [import]uid: 46343 topic_id: 18740 reply_id: 72086[/import]

Ok i did print “Changing scene to menu” in the main.lua file and it said Changing scene to menu, but it went to main.lua. Also on the 4th line in menu.lua i did print “new() for menu.lua” and i saw that in the terminal also but it displayed main.lua. Another note if i remove local function changeScene(e) if(e.phase == "ended" or e.phase == "cancelled") then director:changeScene(e.target.scene); end end
it goes to the menu.lua file and not the main.lua [import]uid: 69054 topic_id: 18740 reply_id: 72089[/import]