Quick Links: Download Gideros Studio | Gideros Documentation | Gideros community chat | DONATE
How can i change my .lua names? — Gideros Forum

How can i change my .lua names?

AxlFlameAxlFlame Member
edited October 2012 in General questions
Hi,

I have some classes that i wanted to change names, like from gameClass to GameClass, but for some reason, Gideros won't allow it. I'm using the scene manager, by the way. How can i do it?

My scenemanager code:
sceneManager = SceneManager.new({
	--start scene
	["start"] = start,
	--options scene
	["options"] = options,
	--game scene
	["gameClass"] = gameClass
})
And when i call the scene at my bonecosSelection class on line 85:
sceneManager:changeScene("gameClass", 1, transition, easing.outBack)
I get this error:

classes/scenemanager.lua:286: attempt to index field '?' (a nil value)
stack traceback:
classes/scenemanager.lua:286: in function 'changeScene'
Area Selections/bonecos_selection.lua:85: in function

Thank you in advance,

Yuri

Comments

  • MellsMells Guru
    edited October 2012
    Hi Yuri,

    did you
    1. Rename your files on your computer
    2. Delete your file from your Gideros project hierarchy
    3. "Add Existing file" once again to your project
    4. Check your code dependencies
    Did it solve your problem?

    Currently Gideros doesn't allow to modify and refresh your file names on your project without doing all of this.
    But I'm sure @atilim is working on some improvements (for example the possibility to drag files to project, or automatically include files that are contained in a folder on your computer).
    twitter@TheWindApps Artful applications : The Wind Forest. #art #japan #apps
  • @AxlFlame: You need to update the dependencies so that bonecos_selection.lua is dependent on gameClass.lua.

    To do this, right click on bonecos_selection.lua in your file hierarchy and select code dependencies from the menu then set the checkbox next to gameClass.lua and close the dependencies window.
  • Hey guys,

    So, I tried following those steps and make bonecos_selection dependent of gameClass and it still doesn't work.

    After doing all that I changed the calls inside the code to what I wanted:
     sceneManager = SceneManager.new({
    	--start scene
    	["start"] = start,
    	--options scene
    	["options"] = options,
    	--game scene
    	["GameClass"] = GameClass
    })
     
    sceneManager:changeScene("GameClass", 1, transition, easing.outBack)
    Even with that it still can't find the file if I rename it.

    Oddly enough, if I just change the name of the file, delete from the hierarchy, put it back, and don't change the calls inside the code, it works... why is that? I mean, if I change gameClass to GameClass, the former shouldn't exist anymore, right?
  • MellsMells Guru
    Accepted Answer
    did you change :
    gameClass = Core.class(Sprite)
    to
    GameClass = Core.class(Sprite)
    (and also GameClass:init(), GameClass:onEnterBegin(), etc...)
    in GameClass.lua?
    twitter@TheWindApps Artful applications : The Wind Forest. #art #japan #apps
  • It worked! It seems that I was forgetting to change these calls inside GameClass.lua, thanks a lot!

    One more thing... I'm not sure I get why bonecos_selection needs to be dependant of GameClass.lua. How does that contribute to make it work?
  • @AxlFlame

    One more thing... I'm not sure I get why bonecos_selection needs to be dependant of GameClass.lua. How does that contribute to make it work?
    You can try to uncheck the dependency between bonecos_selection and GameClass and see if an error is raised or not.
    But GameClass should already exist when changeScene() is called (it's done when you start the player) so I don't think that you need to add a code dependency between bonecos_selection.lua and GameClass.lua (unless I am missing something).

    Likes: AxlFlame

    twitter@TheWindApps Artful applications : The Wind Forest. #art #japan #apps
    +1 -1 (+1 / -0 )Share on Facebook
Sign In or Register to comment.