Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function onSave()
- local data_to_save = {saved_count1 = countHP, saved_count2 = countMP}
- saved_data = JSON.encode(data_to_save)
- return saved_data
- end
- --Loads the saved data then creates the buttons
- function onload(saved_data)
- generateButtonParamiters()
- --Checks if there is a saved data. If there is, it gets the saved value for 'count'
- if saved_data != '' then
- local loaded_data = JSON.decode(saved_data)
- countHP = loaded_data.saved_count1
- countMP = loaded_data.saved_count2
- else
- --If there wasn't saved data, the default value is set to 10.
- countHP = 0
- countMP = 0
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement