GG Data question

Hi guys,

Can you help me with a hint please  :slight_smile:

I tried using following GGdata and roaminggamer code to protect data from tampering.

Code is here: http://roaminggamer.com/secure-data-storage-for-corona-sdk/

My problem is that I cannot save values like this in main.lua file:

-- main.lua file  local settings = require "settings" local saveMyScore local wasPurchased = settings.get( "purchased" ) function saveMyScore() settings.set( "purchased", true ) -- THIS LINE RETURN AN ERROR "unable to index global variable settings" end saveMyScore() -- calling this function somewhere

I have to add one modification to above code, and that is: require settings twice (second time inside saveMyScore function).

So code works like this:

function saveMyScore() local settings = require "settings" -- SECOND SETTINGS REQUIREMENT settings.set( "purchased", true ) end

What is going on here, why I have to do SECOND SETTINGS REQUIREMENT inside saveMyScore function?

This is not a “normal” scope lua behaves, because “settings” should be visible to “saveMyScore” in first scenario?

Waiting your reply  :slight_smile:

Many thanks.

Ivan

Here is 50 degrees today, my brain does not work  :blink:

I found a solution, my mistake: whole code was inside another function!

I apologize to all of you.

Ivan

Here is 50 degrees today, my brain does not work  :blink:

I found a solution, my mistake: whole code was inside another function!

I apologize to all of you.

Ivan