1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-08-01 17:38:41 +00:00

Add minetest.safe_write_file() to script API

This commit is contained in:
sfan5 2017-11-07 11:46:06 +01:00
parent 9526c68699
commit b692454f70
3 changed files with 25 additions and 0 deletions

View file

@ -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"