summaryrefslogtreecommitdiff
path: root/builtin/mainmenu_helper.lua
diff options
context:
space:
mode:
authorsapier <Sapier at GMX dot net>2013-07-16 20:56:18 +0200
committerPilzAdam <pilzadam@minetest.net>2013-07-22 18:10:00 +0200
commite3827fbc23d91b65e33a64dc029ff1ab1bf1b48b (patch)
treee232b222a62a085be3f5d15ca98ec7e5ceab63e9 /builtin/mainmenu_helper.lua
parent5160be91ae6af23cabec5c7412a1c2c45fc46afb (diff)
downloadminetest-e3827fbc23d91b65e33a64dc029ff1ab1bf1b48b.tar.gz
minetest-e3827fbc23d91b65e33a64dc029ff1ab1bf1b48b.tar.bz2
minetest-e3827fbc23d91b65e33a64dc029ff1ab1bf1b48b.zip
Fix background/overlay/footer/header handling
Add missing file headers
Diffstat (limited to 'builtin/mainmenu_helper.lua')
-rw-r--r--builtin/mainmenu_helper.lua58
1 files changed, 58 insertions, 0 deletions
diff --git a/builtin/mainmenu_helper.lua b/builtin/mainmenu_helper.lua
index 25ad072fd..1bdd33cc6 100644
--- a/builtin/mainmenu_helper.lua
+++ b/builtin/mainmenu_helper.lua
@@ -105,3 +105,61 @@ function explode_textlist_event(text)
return retval
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 \ No newline at end of file