mirror of
https://github.com/ExeVirus/formspec_editor.git
synced 2025-09-22 11:26:44 -04:00
allow to load a different file
This commit is contained in:
parent
8f1c543794
commit
0bb9ecd798
3 changed files with 12 additions and 2 deletions
|
@ -12,6 +12,12 @@ local modpath = minetest.get_modpath("formspec_edit")
|
|||
local insecure_env = minetest.request_insecure_environment()
|
||||
local update_time = tonumber(minetest.settings:get("formspec_editor.update_time")) or 0.2
|
||||
|
||||
--Load provided file if present
|
||||
local filepath = minetest.settings:get("formspec_editor.file_path")
|
||||
if not filepath or filepath == "" then
|
||||
filepath = modpath .. "/formspec.spec"
|
||||
end
|
||||
|
||||
local error_formspec = [[
|
||||
formspec_version[4]
|
||||
size[8,2]
|
||||
|
@ -70,7 +76,7 @@ end
|
|||
-----------------------------------
|
||||
load_formspec = function()
|
||||
local io = insecure_env.io
|
||||
local file = io.open(modpath .. "/formspec.spec", "rb")
|
||||
local file = io.open(filepath, "rb")
|
||||
if file == nil then
|
||||
return error_formspec
|
||||
else
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue