Skip to content

Commit

Permalink
Merge pull request #91189 from emanvidmaker/patch-1
Browse files Browse the repository at this point in the history
Docs: Fix FileAccess example conflicting with global scope `load`
  • Loading branch information
akien-mga committed Apr 26, 2024
2 parents a07f89b + 40651eb commit 9bb448f
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions doc/classes/FileAccess.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down

0 comments on commit 9bb448f

Please sign in to comment.