I am getting an error when I execute main.lua off the bat. The codes are straight from a tutorial so I absolutely have no idea why it wouldn’t work. Using director 1.3 and Corona build 569.
Errors I am getting:
[blockcode]
Runtime error
/Users/admin/Desktop/SHARE/Star/director.lua:440: ERROR: table expected. If this is a function call, you might have used ‘.’ instead of ‘:’
stack traceback:
[C]: ?
[C]: in function ‘insert’
/Users/admin/Desktop/SHARE/Star/director.lua:440: in function ‘_listener’
?: in function <?:446>
?: in function <?:215>
Director ERROR: Failed to execute function: 0x5de130( params ) function on ‘menu’.
[/blockcode]
Here’s main.lua
local director = require("director")
local mainGroup = display.newGroup()
local main = function ()
-- add the group from director class
mainGroup:insert(director.directorView)
-- change scene without effects
-- open menu.lua file
director:changeScene("menu")
return true
end
main()
Here’s menu.lua
[code]
module(…, package.seeall)
function new()
local localGroup = display.newGroup()
local background = display.newImageRect(“menu-bg.png”, 480, 320)
background.setReferencePoint(display.CenterReferencePoint)
background.x = 240
background.y = 160
local title = display.newImageRect(“title.png”, 300, 52)
title.setReferencePoint(display.CenterReferencePoint)
title.x = 240
title.y = 100
local play_btn = display.newImageRect(“play.png”, 80, 32)
play_btn.setReferencePoint(display.CenterReferencePoint)
play_btn.x = 240
play_btn.y = 150
play_btn.scene = “game”
local credits_btn = display.newImageRect(“credits.png”, 180, 68)
credits_btn.setReferencePoint(display.CenterReferencePoint)
credits_btn.x = 240
credits_btn.y = 200
credits_btn.scene = “credits”
– functions
function changeScene(e)
if(e.phase == “ended”) then
director:changeScene(e.target.scene)
end
end
localGroup:insert(background)
localGroup:insert(title)
localGroup:insert(play_btn)
localGroup:insert(credits_btn)
play_btn:addEventListener(“touch”, changeScene)
credits_btn:addEventListener(“touch”, changeScene)
return localGroup
end
[/code] [import]uid: 39031 topic_id: 12548 reply_id: 312548[/import]