problems with event.type == "applicationStart" and global variables

I am trying to read a sequence of 1 and 0 in from a file on the event.type == “applicationStart” even and use the values to change global variables to form the app settings (so what even the user enables stays enabled etc)

I am on with up to reading them in but I can’t see to get the values pushed into the main for the execution cycle.

So:-

I thought that by defining the variables with no local prefix they are global so should be able to be read by the code (as I am presuming the event.type == “applicationStart”) causes this to be executed before any of the main code e.g. lines at the top of the main.lua file etc.

I am then trying to say if the fd (from disk version of this property) is populated (it has been read from flash etc) then use that else use a default.

The reading from flash is ok but the variable g_fdLetterAudio is local to the function that reads from disk so I’m not able to use it to set the global variabled used to represent the setting (on/off) etc.

g_LetterAudio = 1 --Speak Letter “A”
g_ObjectAudio = 1 --Speak Object “Dog”
if g_fdLetterAudio == nil then
print(“is it nill”)
g_LetterAudio = 1
else
g_LetterAudio = g_fdLetterAudio
end
if g_fdObjectAudio == nil then
g_ObjectAudio = 1
else
g_ObjectAudio = g_fdObjectAudio
end
function shouldResume()
– return true or false depending on whether we need to resume
local file = io.open( path, “r” )
if file then
–local contents = {}
–print( "Contents of " … path … “\n” … contents )
local count = 0

for line in file:lines() do
count = count +1
print("Possition : “…count…” = "…line)

if count == 1 then
currentPageNo = line
end

if count == 2 then
g_fdLetterAudio = line
end

if count == 3 then
g_fdObjectAudio = line
end

if count == 4 then
g_fdAnswerAudio = line
end

if count == 5 then
g_fdAnswerEffectAudio = line
end

if count == 6 then
g_fdsilhouettes = line
end

if count == 7 then
g_fdphonicsAudio = line
end

end
io.close( file )
print("**Data Read from Disk")
–CheckSettingState()
end

local function onSystemEvent( event )
if event.type == “applicationExit” then
– save stuff to disk
saveData()
end

if event.type == “applicationStart” then
shouldResume()

end
end [import]uid: 5872 topic_id: 3541 reply_id: 303541[/import]