summaryrefslogtreecommitdiff
path: root/builtin/common
diff options
context:
space:
mode:
authorWuzzy <wuzzy2@mail.ru>2020-03-06 20:19:14 +0000
committerGitHub <noreply@github.com>2020-03-06 20:19:14 +0000
commitce8cdc03337ac20b998620f2690eb76e5434ffb9 (patch)
tree7ddef6b915122cebc50815dbeb4599cf53369cea /builtin/common
parent9ca0b3739cbaceaa291ac5062ab219e0aa7c49cb (diff)
downloadminetest-ce8cdc03337ac20b998620f2690eb76e5434ffb9.tar.gz
minetest-ce8cdc03337ac20b998620f2690eb76e5434ffb9.tar.bz2
minetest-ce8cdc03337ac20b998620f2690eb76e5434ffb9.zip
Cleanup global namespace pollution in builtin (#9451)
Diffstat (limited to 'builtin/common')
-rw-r--r--builtin/common/misc_helpers.lua72
1 files changed, 1 insertions, 71 deletions
diff --git a/builtin/common/misc_helpers.lua b/builtin/common/misc_helpers.lua
index 1e9a08851..715f89bc4 100644
--- a/builtin/common/misc_helpers.lua
+++ b/builtin/common/misc_helpers.lua
@@ -5,7 +5,7 @@
local string_sub, string_find = string.sub, string.find
--------------------------------------------------------------------------------
-function basic_dump(o)
+local function basic_dump(o)
local tp = type(o)
if tp == "number" then
return tostring(o)
@@ -201,18 +201,6 @@ function table.indexof(list, val)
end
--------------------------------------------------------------------------------
-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"))
end
@@ -254,64 +242,6 @@ function math.factorial(x)
return v
end
---------------------------------------------------------------------------------
-function get_last_folder(text,count)
- local parts = text:split(DIR_DELIM)
-
- if count == nil then
- return parts[#parts]
- end
-
- local retval = ""
- for i=1,count,1 do
- retval = retval .. parts[#parts - (count-i)] .. DIR_DELIM
- end
-
- return retval
-end
-
---------------------------------------------------------------------------------
-function cleanup_path(temppath)
-
- local parts = temppath:split("-")
- temppath = ""
- for i=1,#parts,1 do
- if temppath ~= "" then
- temppath = temppath .. "_"
- end
- temppath = temppath .. parts[i]
- end
-
- parts = temppath:split(".")
- temppath = ""
- for i=1,#parts,1 do
- if temppath ~= "" then
- temppath = temppath .. "_"
- end
- temppath = temppath .. parts[i]
- end
-
- parts = temppath:split("'")
- temppath = ""
- for i=1,#parts,1 do
- if temppath ~= "" then
- temppath = temppath .. ""
- end
- temppath = temppath .. parts[i]
- end
-
- parts = temppath:split(" ")
- temppath = ""
- for i=1,#parts,1 do
- if temppath ~= "" then
- temppath = temppath
- end
- temppath = temppath .. parts[i]
- end
-
- return temppath
-end
-
function core.formspec_escape(text)
if text ~= nil then
text = string.gsub(text,"\\","\\\\")