Advertisement
lavalevel

save on exit

Oct 9th, 2013
115
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.48 KB | None | 0 0
  1. local function saveGame()
  2.  
  3. _disk.saveTable( _gamedata, "SaveGameData.txt", system.DocumentsDirectory)
  4. print ("  STUFF 'SAVED' to DISK ")
  5. end
  6.  
  7. local function onSystemEvent ( event )
  8.  
  9.     print ( event.name .. ", " .. event.type )
  10.     print ("getPrevious event type: " .. tostring (previousEvent))
  11.     print ()
  12.  
  13.     if "applicationExit" == event.type then
  14.         saveGame()
  15.     end
  16.  
  17.     if "applicationReset" == event.type then
  18.         saveGame()
  19.     end
  20.     previousEvent = event.type
  21.  
  22.     return true
  23. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement