From 4d9b7ca0aab976400cfbb4952b2b981033d1bf17 Mon Sep 17 00:00:00 2001 From: Lars Mueller Date: Wed, 1 Sep 2021 17:07:26 +0200 Subject: [PATCH] Add file.split_extension --- file.lua | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/file.lua b/file.lua index 4cf6db8..257f346 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 split_extension(filename) + return filename:match"(.*)%.(.*)$" +end + function read(filename) local file = io.open(filename, "r") if file == nil then return nil end