Add file.get_name

This commit is contained in:
Lars Mueller 2021-11-04 17:03:41 +01:00
parent c0ea0dba47
commit dc80e8b45c

@ -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