composer not working?

Hi, 

I’m new to this forum, so I apologize in advance if something is wrong. 

I have a problem with a certain part of the code:

local timer = require( "timer" ) local composer = require( "composer" ) local Listener = composer.gotoScene( "list" ) timer.performWithDelay(2000, Listener )

I have no idea where the error is. 

List.lua file exists. 

As you can see I join composer, timer … 

In theory it should work.

I created it with the Listener function, but the effect was the same.

This is a error:

list.lua:19: ERROR: table expected. If this is a function call, you might have used ‘.’ instead of ':'

stack traceback:

[C]: in function ‘error’
?: in function ‘gotoScene’
main.lua:68: in main chunk

I would be grateful for your help.

P.S. 

My english can be … difficult to understand. Very sorry for it.

Hello @pawel.grabowski5,

This is not a valid way to call .gotoScene, as far as I know. Try something like this:

[lua]

local function Listener()

    composer.gotoScene( “list” )

end

timer.performWithDelay( 2000, Listener )

[/lua]

Brent

too, so I tried and did not work.

Moment ago I put this code and error like this:

list.lua:19: ERROR: table expected. If this is a function call, you might

have used ‘.’ instead of ‘:’

stack traceback:

[C]: in function ‘error’

?: in function ‘gotoScene’

main.lua:74: in function ‘_listener’

?: in function <?:141>

?: in function <?:221>

Actually, I see another problem in your code. Do not require the “timer” library. It’s already part of the core.

you’re right. 

I removed the attachment but still shows the same error. 

I think there is something wrong with gotoScene (), but i don’t know what.

==EDIT==

re-copy code:

local composer = require( "composer" ) local function listener( ) composer.gotoScene( "list" ) end timer.performWithDelay( 1000, listener )

Is “list.lua” structured in the proper way for a Composer scene? See the “Scene Template” sample here:

http://docs.coronalabs.com/api/library/composer/index.html

This is also the existing scene file?

(Overlooked this example, when I read the documentation. :confused: )

Hi again,

If you haven’t used Composer before, you should begin with the following guide. Composer must be structured in a specific way for everything to work in harmony.

http://docs.coronalabs.com/guide/system/composer/index.html

Take care,

Brent

I take as read :slight_smile:

Paul

Also in the SampleCode/Interface/Composer folder is a good example sample app that shows you how everything interacts.

Rob

Ok. Working.

[member=‘Brent Sorrentino’] :

Thanks a lot. 

Actually - in my script, there were not many elements. This tutorial helped me. I do not know how, but I totally did not notice that they are guides to everything. The next time I have to be more careful. 

Thanks a lot to everyone. 

And by the way … 

How to check if a file exists? :slight_smile:

I would be grateful even for the same indication link

Paul

Hello @pawel.grabowski5,

This is not a valid way to call .gotoScene, as far as I know. Try something like this:

[lua]

local function Listener()

    composer.gotoScene( “list” )

end

timer.performWithDelay( 2000, Listener )

[/lua]

Brent

too, so I tried and did not work.

Moment ago I put this code and error like this:

list.lua:19: ERROR: table expected. If this is a function call, you might

have used ‘.’ instead of ‘:’

stack traceback:

[C]: in function ‘error’

?: in function ‘gotoScene’

main.lua:74: in function ‘_listener’

?: in function <?:141>

?: in function <?:221>

Actually, I see another problem in your code. Do not require the “timer” library. It’s already part of the core.

you’re right. 

I removed the attachment but still shows the same error. 

I think there is something wrong with gotoScene (), but i don’t know what.

==EDIT==

re-copy code:

local composer = require( "composer" ) local function listener( ) composer.gotoScene( "list" ) end timer.performWithDelay( 1000, listener )

Is “list.lua” structured in the proper way for a Composer scene? See the “Scene Template” sample here:

http://docs.coronalabs.com/api/library/composer/index.html

This is also the existing scene file?

(Overlooked this example, when I read the documentation. :confused: )

Hi again,

If you haven’t used Composer before, you should begin with the following guide. Composer must be structured in a specific way for everything to work in harmony.

http://docs.coronalabs.com/guide/system/composer/index.html

Take care,

Brent

I take as read :slight_smile:

Paul

Also in the SampleCode/Interface/Composer folder is a good example sample app that shows you how everything interacts.

Rob