lua:12: attempt to index a boolean value

Have a error that I can’t understand.

what i’m trying to do is to load a new level(lua) file when I click on a object. It WORKS but I get the following message in the debug window.?? so it’s not like I’m stuck I just need to understand why!!

Can someone please explain why it happens ? !

Error:

Runtime error
/Users/rotter/Dropbox/phoneGame/CuBes/main.lua:12: attempt to index a boolean value
stack traceback:
[C]: ?
/Users/rotter/Dropbox/phoneGame/CuBes/main.lua:12: in function ‘loadScreen’
/Users/rotter/Dropbox/phoneGame/CuBes/main.lua:16: in function

Code
[lua]local Group1
group1 = {}
group1= display.newGroup()
local file1 = “bluebrick.png”
local BlueBrick = display.newImage( file1 )
group1:insert(BlueBrick, true )
group1.x = 160
group1.y = 80

local function loadScreen(newScreen)

currentScreen = require(newScreen).new()
end
local buttonListener = function( event )
group1:removeSelf()
loadScreen(“lvl1”)

end
group1:addEventListener( “touch”, buttonListener )[/lua]
[import]uid: 31201 topic_id: 11562 reply_id: 311562[/import]

maybe inside of new()

i need more info - whats on your new?
c [import]uid: 24 topic_id: 11562 reply_id: 41987[/import]

@rotter,

  1. your variable is defined as “Group1”, where as you are referring to it as “group1”

  2. you are setting your currentscene with a return value of the function new from the module newScreen, which is supposed to be a lua file, newScreen is not defined anywhere, if you had
    [lua] currentscene=require(“newScreen”).new()[/lua]

cheers,

?:slight_smile: [import]uid: 3826 topic_id: 11562 reply_id: 42013[/import]