Parameters between story boards using Android back button

Greetings all! 16BitGoose here I am new to the Corona SDK community.

I am facing what is likely a pretty simple problem. Hopefully this is a clear enough explanation.

Using the newSwitch/radio widget I am passing parameters throughout my storyboard scenes. As an example here is one of my implementations

stage_four.lua

local params = event.params

local function onTapTimeZone( event ) local switch = event.target local options = { effect = "fade", time = 400, params = { isClickedTime = params.isClickedTime, isClickedTimeZone = tostring(switch.id), isClickedDirection = params.isClickedDirection, } } storyboard.gotoScene( "result", options ) end 

My problem occurs when I wish to use the android back button and make the newSwitch/Radio parameter being passed nil upon exiting the result scene

here is how I am attempting to do that in result.lua

function scene:enterScene( event ) local group = self.view g.lastScene = "stage\_four" end -- Called when scene is about to move offscreen: function scene:exitScene( event ) local group = self.view local params = event.params params.isClickedTimeZone = nil end

Doing this I no longer can choose a new parameter from the newSwitch/Radio widget. On stage_four the widget becomes unresponsive. Attempting other methods the information remains in memory or totally clears everything and does not work as expected either.

Is there a way I can selectively choose which variables to remove upon exiting a scene using the back button or perhaps someone can recommend other methods?

For sake of reference this codes exists in my main.lua file for travelling backwards on an Android device.

local function goBack() storyboard.gotoScene(g.lastScene) end local function onKeyEvent( event ) local keyname = event.keyName if (event.phase == "up" and (event.keyName=="back")) then if keyname == "back" then goBack() end end return true end -- Add the key callback if system.getInfo( "platformName" ) == "Android" then Runtime:addEventListener( "key", onKeyEvent ) end

Thank you for any assistance