18 lines
337 B
GDScript3
18 lines
337 B
GDScript3
|
extends Node
|
||
|
|
||
|
func loadJSON(savePath):
|
||
|
var data
|
||
|
if not FileAccess.file_exists(savePath):
|
||
|
return 1
|
||
|
var fileAccess = FileAccess.open(savePath, FileAccess.READ)
|
||
|
var jsonString = fileAccess.get_line()
|
||
|
fileAccess.close()
|
||
|
|
||
|
var json = JSON.new()
|
||
|
var error = json.parse(jsonString)
|
||
|
if error:
|
||
|
return 1
|
||
|
|
||
|
data = json.data
|
||
|
return data
|