Skip to content

Commit 8454524

Browse files
authored
Merge pull request #9967 from Calinou/saving-games-fix-json-data
Fix outdated `get_data()` JSON method usage in Saving games
2 parents 4361f19 + 802f5b4 commit 8454524

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

tutorials/io/saving_games.rst

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -232,17 +232,17 @@ load function:
232232
while save_file.get_position() < save_file.get_length():
233233
var json_string = save_file.get_line()
234234

235-
# Creates the helper class to interact with JSON
235+
# Creates the helper class to interact with JSON.
236236
var json = JSON.new()
237237

238-
# Check if there is any error while parsing the JSON string, skip in case of failure
238+
# Check if there is any error while parsing the JSON string, skip in case of failure.
239239
var parse_result = json.parse(json_string)
240240
if not parse_result == OK:
241241
print("JSON Parse Error: ", json.get_error_message(), " in ", json_string, " at line ", json.get_error_line())
242242
continue
243243

244-
# Get the data from the JSON object
245-
var node_data = json.get_data()
244+
# Get the data from the JSON object.
245+
var node_data = json.data
246246

247247
# Firstly, we need to create the object and add it to the tree and set its position.
248248
var new_object = load(node_data["filename"]).instantiate()
@@ -284,7 +284,7 @@ load function:
284284
{
285285
var jsonString = saveFile.GetLine();
286286

287-
// Creates the helper class to interact with JSON
287+
// Creates the helper class to interact with JSON.
288288
var json = new Json();
289289
var parseResult = json.Parse(jsonString);
290290
if (parseResult != Error.Ok)
@@ -293,7 +293,7 @@ load function:
293293
continue;
294294
}
295295

296-
// Get the data from the JSON object
296+
// Get the data from the JSON object.
297297
var nodeData = new Godot.Collections.Dictionary<string, Variant>((Godot.Collections.Dictionary)json.Data);
298298

299299
// Firstly, we need to create the object and add it to the tree and set its position.

0 commit comments

Comments
 (0)