Writing to a file permanently ?

I want to write to a value in my lua module, using the code below:

local levelPacks = require "levelpacks"  
  
if levelPacks[locCurrentLevelPack][locCurrentLevel].score \>  
 levelPacks[locCurrentLevelPack][locCurrentLevel].hScore then  
  
 levelPacks:write(levelPacks[locCurrentLevelPack][locCurrentLevel].hScore =   
 levelPacks[locCurrentLevelPack][locCurrentLevel].score)   
  
end  
  

I’ve tried wrapping the code in the if block in, io.write( ) and levelPacks:write( ). Do I need to include the io namespace? Any pointers please, thanks.

Lewis. [import]uid: 87611 topic_id: 14631 reply_id: 314631[/import]

Do you just want to change the score within the app’s runtime or are you attempting to save the score to a file ?

If it’s saving, have you considered or tried JSON ? [import]uid: 84637 topic_id: 14631 reply_id: 54224[/import]

Yeah I realise I can’t edit the structure as its in a certain directory that doesn’t allow me to do so, just converted my structure to JSON now to have another go. [import]uid: 87611 topic_id: 14631 reply_id: 54237[/import]