[Solved] Switch scene in lua

  • #1, by andy-rinaldiWednesday, 24. September 2014, 23:45 10 years ago
    I'm not able to find the correct syntax in order to switch a scene in lua code.




    Forum Fan

    160 Posts

  • #2, by AlexThursday, 25. September 2014, 00:06 10 years ago
    should be something like
    game:setLink(VGameCurrentScene, getObject('Scenes[scene_name]'))

    Great Poster

    378 Posts

  • #3, by afrlmeThursday, 25. September 2014, 02:25 10 years ago
    It's setValue not setLink. smile
    game:setValue( VGameCurrentScene, getObject("Scenes[scene_name]") )

    ...setLink returns a nil value.

    Changing data structure tables is always done via the setValue function. game: is only used for accessing/setting entries in the game table. Aside from that, almost everything else can be accessed via getObject; actually the game table can also be accessed via getObject also...
    getObject("Game.GameCurrentScene") -- is the same as...


    7283 Posts

  • #4, by andy-rinaldiThursday, 25. September 2014, 10:52 10 years ago
    AFRLme is right. The script is working fine.


    Forum Fan

    160 Posts