Programatically reference the name of the lua file your code is in?

I’m using the storyboard API to manage an interactive comic I’m developing (many lua files as individual scenes).

I have an options screen/scene that will be available from any of the scenes of the comic where the player can look at certain over arching story info. I update a global variable in each of my comic scenes so that the game knows what scene to return to from the options scene (for example, in the scene001.lua file- \_G["current\_scene"] = "scene001")

Rather than having to manually update this variable in each scene that I build from my master template (“scene001”, “scene002”, etc.), is there some way to write a function that can return the name of the scene (lua) file without the “.lua” attached to it? That way I can set the global variable on each new comic scene entered and the options scene will always go back to the most recent scene.

Thanks in advance for any advice you can offer :slight_smile: [import]uid: 105707 topic_id: 21556 reply_id: 321556[/import]

EHO,
Try

storyboard.getPrevious()  

This should give you the name of the lua file.

Hope this helps. [import]uid: 84539 topic_id: 21556 reply_id: 85435[/import]

Wow, that really simplifies the process (get to get rid of that global variable!)

Thanks for the heads up on that function… I’m getting fried on this project and missed that in the API reference :slight_smile: [import]uid: 105707 topic_id: 21556 reply_id: 85438[/import]

Hmm… have been attempting something a little more robust than my previous efforts and have run into a bit of a wall with the getPrevious() function. It’s fine in a “linear” set up but with scenes that may return to multiple other scenes (for instance from an “options” page to different “levels”) I’m having some problems.

Will post more as I better understand the scope of the problem.

[import]uid: 105707 topic_id: 21556 reply_id: 86769[/import]