mirror of
https://github.com/sbrl/Minetest-WorldEditAdditions.git
synced 2024-11-22 23:42:59 +00:00
created wea_core.path
This commit is contained in:
parent
97e8bd1361
commit
cbfd695d72
3 changed files with 7 additions and 3 deletions
|
@ -4,7 +4,6 @@ local wea_c = worldeditadditions_core
|
||||||
wea_c.format = {
|
wea_c.format = {
|
||||||
array_2d = dofile(wea_c.modpath.."/utils/format/array_2d.lua"),
|
array_2d = dofile(wea_c.modpath.."/utils/format/array_2d.lua"),
|
||||||
escape = dofile(wea_c.modpath.."/utils/format/escape.lua"),
|
escape = dofile(wea_c.modpath.."/utils/format/escape.lua"),
|
||||||
file_path = dofile(wea_c.modpath.."/utils/format/file_path.lua"),
|
|
||||||
human_size = dofile(wea_c.modpath.."/utils/format/human_size.lua"),
|
human_size = dofile(wea_c.modpath.."/utils/format/human_size.lua"),
|
||||||
human_time = dofile(wea_c.modpath.."/utils/format/human_time.lua"),
|
human_time = dofile(wea_c.modpath.."/utils/format/human_time.lua"),
|
||||||
make_ascii_table = dofile(wea_c.modpath.."/utils/format/make_ascii_table.lua"),
|
make_ascii_table = dofile(wea_c.modpath.."/utils/format/make_ascii_table.lua"),
|
||||||
|
|
5
worldeditadditions_core/utils/path/init.lua
Normal file
5
worldeditadditions_core/utils/path/init.lua
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
local wea_c = worldeditadditions_core
|
||||||
|
|
||||||
|
wea_c.path = {
|
||||||
|
file_path = dofile(wea_c.modpath.."/utils/format/file_path.lua"),
|
||||||
|
}
|
|
@ -7,11 +7,11 @@ local wea_c = worldeditadditions_core
|
||||||
-- @return string The joined path.
|
-- @return string The joined path.
|
||||||
-- @example Basic usage
|
-- @example Basic usage
|
||||||
-- local path = file_path("C:\\Users", "me", "/Documents/code.lua")
|
-- local path = file_path("C:\\Users", "me", "/Documents/code.lua")
|
||||||
local file_path = function( ... )
|
local join = function( ... )
|
||||||
local path = { ... }
|
local path = { ... }
|
||||||
for i, v in ipairs(path) do path[i] = tostring(v) end
|
for i, v in ipairs(path) do path[i] = tostring(v) end
|
||||||
return ({table.concat(path, wea_c.dirsep)
|
return ({table.concat(path, wea_c.dirsep)
|
||||||
:gsub("[/\\]+", wea_c.dirsep)})[1]
|
:gsub("[/\\]+", wea_c.dirsep)})[1]
|
||||||
end
|
end
|
||||||
|
|
||||||
return file_path
|
return join
|
Loading…
Reference in a new issue