Hi,
I have a game which has ads, I have an IAP (working correctly) to remove them. So far so good.
So, I have a variable removeAllAds that will be false until the purchase is complete, the removeAllAds() switches the value to true and stores it.
This works OK
If I manually change the value to true without using the table to save, it works ok.
Issue is it isnt updating the variable value in the global ??? it just returns nil when I print(removeAllAds).
It really is becoming a nightmare for me which is why I am asking for a second pair of eyes.
[lua]
–MAIN.LUA–
_G.storageTable = {}
_G.removeAllAds = storageTable.removeAds
if( io.exists( “saveFile.txt”, system.DocumentsDirectory ) ) then
storageTable = table.load( “saveFile.txt”, system.DocumentsDirectory )
else
storageTable.removeAds = false
table.save( storageTable, “saveFile.txt”, system.DocumentsDirectory )
end
function _G.removeTheAds()
storageTable.removeAds = true
table.save( storageTable, “saveFile.txt”, system.DocumentsDirectory )
end
– MAIN LUA AD FUNCTION –
loadAd = function()
– _G.removeAllAds = storageTable.removeAds – ADDED HERE
if removeAllAds == true then
gameOverScreen()
else
–load the ad–
end
[/lua]