IAP, how to handle many Managed Product when store.restore() ?

This is the code I use from this: https://coronalabs.com/blog/2013/09/03/tutorial-understanding-in-app-purchases/ 

if store.availableStores.google and tstate == "purchased" then local tdate = math.floor( transaction.date /1000 ) local timeStamp = utility.makeTimeStamp(transaction.date,"ctime") if timeStamp + 360 \< os.time() then -- if the time stamp is older than 5 minutes, we will assume a restore. print("map this purchase to a restore") tstate = "restored" print("I think tstate is ", tstate) restoring = false end end if tstate == "purchased" then print("Transaction succuessful!") mySettings.isPaid = true utility.saveTable(mySettings, "settings.json") native.showAlert("Thank you!", "Your support is greatly appreciated!", {"Okay"}) store.finishTransaction( transaction )

so, when we try to use store.restore() function, it will be trigger tstate = “purchased” right? And because the above function, it chande to “restored”, am I wrong?

The example show that change “isPaid” to “true”… However, what if I have many “Managed Products”? For example, if I have managed products: A, B, C, and D. Then what if the user purchased product A and C when he/she reinstall the application in Google Play Store? could you give me some example?

Thanks…