Hi all,
I am bulding a biz app and I am stuck towards later stage of my development. Let me briefly explain the scenario - the app is try to set modifiers in an overlay screen (using showOverlay) for record in a tableView in the parent screen.
An analogy to showcase my example - my parent screen has a table view, each record having a Pizza. On click of one of the record (Pizza) an overlay scene is called which gives the user some options to add/modify pizza attributes (for eg: add Jalapenos, add Cheese, sauce, etc). Once the attributes are selected, the user will save/cancel and go back to the parent screen and the attributes are associated to the parent record (pizza).
Again using the same example, the issue I am facing is not being able to access my table (array) variable which consists of record of pizza along with it’s attributes in overlay screen. I would also like to modify the values of attributes in parent scene from the overlay screen based on what is selected in the overlay screen.
As far as I have read and understood, event.parent is passed on to the overlay scene so that variables of the parent screen are accessible in overlay screen.
Am I correct in my understanding.
Following sample pseudo code will perhaps explain the issue:
– parent scene
basketItemAttributes = {}
– somewhere in the code a loop to populate records and attributes in the above table
basketItemAttributes[Seq] = {}
basketItemAttributes[Seq].prodName = dbRow.prodName
basketItemAttributes[Seq].qty = dbRow.qty
basketItemAttributes[Seq].rate = dbRow.rate
basketItemAttributes[Seq].modifierName1 =""
basketItemAttributes[Seq].selectedModifier1 =""
basketItemAttributes[Seq].modifierName2 =""
basketItemAttributes[Seq].selectedModifier2 =""
basketItemAttributes[Seq].modifierName3 =""
basketItemAttributes[Seq].selectedModifier3 =""
– note the modifier/attributes are blank at this state as i would like to populate them from overlay screen based on what is selected
– somewhere below
composer.showOverlay(“modifiers”,options)
–modifiers.lua
– a screen with table of modifier options and on selection of a modifier be able to populate the same in variable of parent screen
– for eg:
event.parent.basketItemAttributes[Seq].modifierName1 =“Sauce”
basketItemAttributes[displaySeq].selectedModifier1 =“Tomato”
event.parent.basketItemAttributes[Seq].modifierName1 =“Cheese”
basketItemAttributes[displaySeq].selectedModifier1 =“Cheddar”
The issue is I am not even be able to access the parent variable in overlay screen. For eg: print(basketItemAttributes[Seq].prodName) gives me an error "attempt to index local parent (a nil value).
Can someone help me please. Ask any questions if somethings not clear.
Thanks,