1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-08-21 18:11:11 +00:00

Add minetest.safe_write_file() to script API

This commit is contained in:
sfan5 2017-11-07 11:46:06 +01:00 committed by SmallJoker
parent 313ca53b36
commit b816c63196
3 changed files with 25 additions and 0 deletions

View file

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