request insecure env properly

This commit is contained in:
AFCMS 2021-07-20 00:52:23 +02:00
parent b0be851f2d
commit 17f1c4a4a5
2 changed files with 9 additions and 0 deletions

View file

@ -5,6 +5,10 @@
## Getting Started
This mod needs access to an insecure environment in order to work.
Add `formspec_edit` to `secure.trusted_mods` in your `minetest.conf` file.
The file *formspec.spec* in your:
```minetest_folder/games/formspec_editor/mods/formspec_edit```

View file

@ -9,7 +9,12 @@ minetest.register_alias("mapgen_water_source", "air")
--Variables
local modpath = minetest.get_modpath("formspec_edit")
local insecure_env = minetest.request_insecure_environment()
if not insecure_env then
error("[formspec_editor] Cannot access insecure environment!")
end
local io = insecure_env.io
local update_time = tonumber(minetest.settings:get("formspec_editor.update_time")) or 0.2