composer.getScene not working ok

Hi,

I am having problems with composer.getScene. I am checking if the scene exists  ( composer.getScene doesn’t return nil ) and then preload that scene, however this code doesn’t get executed even if the file is there. Funny enough it does if I write == nil instead of ~= nil for the scene that does exist. This is a silly example, but in a game I am trying to implement this on next scene button so that I don’t have to hardcode every scene. Here is the silly code example:

if nil ~= composer.getScene("scene2") then composer.loadScene("scene2", true); print("got scene2") end

Ok, I figured getScene~= nil checks only if the scene is loaded inside current scene and not the way I thought. Since I can’t delete the previous post alltogether - the case is closed;)

Ok, I figured getScene~= nil checks only if the scene is loaded inside current scene and not the way I thought. Since I can’t delete the previous post alltogether - the case is closed;)