add lua sandbox, tabs, stuff

This commit is contained in:
unknown
2022-02-18 17:29:31 -05:00
parent 2593c55ee3
commit fa1f4894af
12 changed files with 436 additions and 36 deletions

View File

@ -1,7 +1,7 @@
{
"name": "touch",
"license": "MIT",
"version": 0.2,
"engine": 0.4,
"version": 0.3,
"engine": 0.42,
"help": "creates a file in the current path"
}

View File

@ -3,11 +3,14 @@ function touch(pos, input, data)
--make dir to be safe
minetest.mkdir(path)
if #minetest.get_dir_list(path, false) > 10
and not minetest.check_player_privs(data.player, "computers_filesystem") then
return "ERROR: you have reached your max file limit"
end
if input and input ~= "" and not input:find("/") then
for _, item in pairs(minetest.get_dir_list(path, nil)) do
if item == input then
return "ERROR: trying to create already existing file/folder"
end
if computers.api.get_dir_keyed_list(path, nil)[input] then
return "ERROR: trying to create already existing file/folder"
end
minetest.safe_file_write(path .. "/" .. input, "")
return "file " .. input .. " created"