From dc80e8b45c80911e0faf7e20912772fe33921066 Mon Sep 17 00:00:00 2001 From: Lars Mueller Date: Thu, 4 Nov 2021 17:03:41 +0100 Subject: [PATCH] Add file.get_name --- file.lua | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/file.lua b/file.lua index 48adc66..d7a6308 100644 --- a/file.lua +++ b/file.lua @@ -5,6 +5,10 @@ local io, minetest, modlib, string = io, minetest, modlib, string local _ENV = {} setfenv(1, _ENV) +function get_name(filepath) + assert(#modlib.dir_delim == 1) + return filepath:match(modlib.dir_delim .. "?(.-)$") +end function get_extension(filename) return filename:match"(.*)%.(.*)$" end