Advertisement
toffesource

Global_DataParser

Jan 26th, 2018
323
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.42 KB | None | 0 0
  1. #Rename Script File to Global_DataParser.gd
  2. extends Node
  3.  
  4. onready var file = File.new()
  5.  
  6. func load_data(url):
  7.     if url == null: return
  8.     if !file.file_exists(url): return
  9.     file.open(url, File.READ)
  10.     var data = {}
  11.     data.parse_json(file.get_as_text())
  12.     file.close()
  13.     return data
  14.    
  15. func write_data(url, dict):
  16.     if url == null: return
  17.     file.open(url, File.WRITE)
  18.     file.store_line(dict.to_json())
  19.     file.close()
  20.     return
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement