From c6492b3d252f07a40e11fc2441f499c557004f36 Mon Sep 17 00:00:00 2001 From: MihailRis Date: Mon, 10 Mar 2025 23:01:34 +0300 Subject: [PATCH] add file.parent(...) --- res/scripts/stdmin.lua | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/res/scripts/stdmin.lua b/res/scripts/stdmin.lua index e2e4d3c7..b62bd9cc 100644 --- a/res/scripts/stdmin.lua +++ b/res/scripts/stdmin.lua @@ -543,3 +543,11 @@ end function file.prefix(path) return path:match("^([^:]+)") 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