summaryrefslogtreecommitdiff
path: root/builtin/common/misc_helpers.lua
diff options
context:
space:
mode:
authorred-001 <red-001@outlook.ie>2017-01-28 21:43:06 +0000
committerLoic Blot <loic.blot@unix-experience.fr>2017-03-19 12:34:33 +0100
commit2e3778ec0c1f77007d064d15310fa816e2a07e88 (patch)
tree6c1a0657057b8f1a549554523d7b5ab1cf49f763 /builtin/common/misc_helpers.lua
parentf8ad01ab7c4cf012781bd4caa821544e676c9267 (diff)
downloadminetest-2e3778ec0c1f77007d064d15310fa816e2a07e88.tar.gz
minetest-2e3778ec0c1f77007d064d15310fa816e2a07e88.tar.bz2
minetest-2e3778ec0c1f77007d064d15310fa816e2a07e88.zip
Block access to the `io` library
Diffstat (limited to 'builtin/common/misc_helpers.lua')
-rw-r--r--builtin/common/misc_helpers.lua17
1 files changed, 9 insertions, 8 deletions
diff --git a/builtin/common/misc_helpers.lua b/builtin/common/misc_helpers.lua
index e145a5bfc..a1417dbd4 100644
--- a/builtin/common/misc_helpers.lua
+++ b/builtin/common/misc_helpers.lua
@@ -197,16 +197,17 @@ assert(table.indexof({"foo", "bar"}, "foo") == 1)
assert(table.indexof({"foo", "bar"}, "baz") == -1)
--------------------------------------------------------------------------------
-function file_exists(filename)
- local f = io.open(filename, "r")
- if f == nil then
- return false
- else
- f:close()
- return true
+if INIT ~= "client" then
+ function file_exists(filename)
+ local f = io.open(filename, "r")
+ if f == nil then
+ return false
+ else
+ f:close()
+ return true
+ end
end
end
-
--------------------------------------------------------------------------------
function string:trim()
return (self:gsub("^%s*(.-)%s*$", "%1"))