diff options
author | sfan5 <sfan5@live.de> | 2017-11-07 11:46:06 +0100 |
---|---|---|
committer | SmallJoker <mk939@ymail.com> | 2018-06-03 17:32:00 +0200 |
commit | b816c631963a429658473b030ab6e7641b587562 (patch) | |
tree | d3110903d1b3f626430620a14f73166fb919f517 /doc | |
parent | 313ca53b368abf376d3207b32fb9c8fd4291965f (diff) | |
download | minetest-b816c631963a429658473b030ab6e7641b587562.tar.gz minetest-b816c631963a429658473b030ab6e7641b587562.tar.bz2 minetest-b816c631963a429658473b030ab6e7641b587562.zip |
Add minetest.safe_write_file() to script API
Diffstat (limited to 'doc')
-rw-r--r-- | doc/lua_api.txt | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/doc/lua_api.txt b/doc/lua_api.txt index 13881ef70..ab5caca0d 100644 --- a/doc/lua_api.txt +++ b/doc/lua_api.txt @@ -2223,6 +2223,10 @@ Helper functions * nil: return all entries, * true: return only subdirectory names, or * false: return only file names. +* `minetest.safe_file_write(path, content)`: returns boolean indicating success + * Replaces contents of file at path with new contents in a safe (atomic) way. + Use this instead of below code when writing e.g. database files: + `local f = io.open(path, "wb"); f:write(content); f:close()` * `minetest.get_version()`: returns a table containing components of the engine version. Components: * `project`: Name of the project, eg, "Minetest" |