mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-12 14:31:50 +00:00
add file.parent(...)
This commit is contained in:
parent
567105dfce
commit
c6492b3d25
1 changed files with 8 additions and 0 deletions
|
|
@ -543,3 +543,11 @@ end
|
||||||
function file.prefix(path)
|
function file.prefix(path)
|
||||||
return path:match("^([^:]+)")
|
return path:match("^([^:]+)")
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function file.parent(path)
|
||||||
|
local pos = path:find("/")
|
||||||
|
if not pos then
|
||||||
|
return file.prefix(path)..":"
|
||||||
|
end
|
||||||
|
return path:sub(0, pos-1)
|
||||||
|
end
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue