From 40651eb642447d05fd2fc25d158659e9c9463c72 Mon Sep 17 00:00:00 2001 From: "Emanuel Acosta Gonzalez (emanvidmaker)" Date: Thu, 25 Apr 2024 18:51:37 -0400 Subject: [PATCH] FileAccess.xml had conflicting function names in its example code In the example code the declared load() function conflicts with global scope load(). so if you copy pasted it in godot 4.2.2 you would get a "Too few arguments for "load()" call. Expected at least 1 but received 0." error since it doesn't override global scope load(). --- doc/classes/FileAccess.xml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/doc/classes/FileAccess.xml b/doc/classes/FileAccess.xml index fafc02734acb..99574da80823 100644 --- a/doc/classes/FileAccess.xml +++ b/doc/classes/FileAccess.xml @@ -8,23 +8,23 @@ Here's a sample on how to write and read from a file: [codeblocks] [gdscript] - func save(content): + func save_to_file(content): var file = FileAccess.open("user://save_game.dat", FileAccess.WRITE) file.store_string(content) - func load(): + func load_from_file(): var file = FileAccess.open("user://save_game.dat", FileAccess.READ) var content = file.get_as_text() return content [/gdscript] [csharp] - public void Save(string content) + public void SaveToFile(string content) { using var file = FileAccess.Open("user://save_game.dat", FileAccess.ModeFlags.Write); file.StoreString(content); } - public string Load() + public string LoadFromFile() { using var file = FileAccess.Open("user://save_game.dat", FileAccess.ModeFlags.Read); string content = file.GetAsText();