mirror of
https://github.com/mt-mods/home_workshop_modpack.git
synced 2025-07-01 16:00:41 +02:00
add lua sandbox, tabs, stuff
This commit is contained in:
@ -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"
|
||||
}
|
@ -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"
|
||||
|
Reference in New Issue
Block a user