diff options
author | sfan5 <sfan5@live.de> | 2017-11-07 11:46:06 +0100 |
---|---|---|
committer | sfan5 <sfan5@live.de> | 2017-11-08 16:14:05 +0100 |
commit | b692454f70cb661a8ce733a4bcbbadcb5edd0049 (patch) | |
tree | ad28f1e120d6c10452df9ce342a06002593d3dc6 /doc | |
parent | 9526c686997285700f500b975a9d971c3ca0a188 (diff) | |
download | minetest-b692454f70cb661a8ce733a4bcbbadcb5edd0049.tar.gz minetest-b692454f70cb661a8ce733a4bcbbadcb5edd0049.tar.bz2 minetest-b692454f70cb661a8ce733a4bcbbadcb5edd0049.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 fd49e8c22..9f92aba99 100644 --- a/doc/lua_api.txt +++ b/doc/lua_api.txt @@ -2380,6 +2380,10 @@ Strings that need to be translated can contain several escapes, preceded by `@`. * 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" |