14 lines
332 B
GDScript
14 lines
332 B
GDScript
extends Node
|
|
|
|
func load_json(filename: String) -> Dictionary:
|
|
var file := File.new()
|
|
var error := file.open(filename, File.READ)
|
|
if error == OK:
|
|
var result = JSON.parse(file.get_as_text())
|
|
if result.error == OK:
|
|
return result.result
|
|
else:
|
|
print_debug(result.error_string)
|
|
print_debug(result.error_line)
|
|
return {}
|