Advertisement
lavalevel

new Load and Save with params

Jan 24th, 2012
157
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.75 KB | None | 0 0
  1. local function save(obj, objFilename)
  2.  
  3.  
  4.        
  5.                 local path = system.pathForFile( objFilename .. ".txt", system.DocumentsDirectory )                
  6.                 local file = io.open( path, "w+b" )              
  7.                
  8.                 file:write(obj)          
  9.                 io.close( file )
  10.        
  11. end
  12.  
  13. local function load(loadFilename)
  14.     print (loadFilename)
  15.  local path = system.pathForFile( loadFilename, system.DocumentsDirectory )                
  16.  local file = io.open( path, "r" )
  17.                
  18.                 if file then
  19.                      
  20.                         local contents = file:read( "*a" )
  21.                         return contents
  22.                         end
  23.                        
  24. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement