fixed some shenanigans

This commit is contained in:
FatalErr42O 2023-08-29 12:38:00 -07:00
parent c2e33d477b
commit 3ee6e724aa
3 changed files with 6 additions and 3 deletions

View File

@ -7,7 +7,7 @@ mtul = {
--optionally allow user to overset local math with mtul while still keeping core funcs & consts.
mtul.math = {}
for i, v in pairs(math) do
mtul[i] = v
mtul.math[i] = v
end
--run files. These will directly modify the mtul sub tables.

View File

@ -10,7 +10,7 @@ local function trim_spacing(text)
return text:match"^%s*(.-)%s*$"
end
--I will add a file reading lib eventually...
local read_file = mtul.file.read or function(mod, filename)
local read_file = function(mod, filename)
local filepath = mtul.utils.get_resource(mod, filename)
local file, err = io.open(filename, "r")
if file == nil then return nil, err end

View File

@ -11,6 +11,9 @@ local media_extensions = {
-- Translations
"tr";
}
local function split_extension(filename)
return filename:match"^(.*)%.(.*)$"
end
--mmmm yes, according to modlib we should make this loop it's own global function apart of modlib. Foolish me thinking we can just make case specific
for i, v in pairs(media_extensions) do
media_extensions[v] = true
@ -21,7 +24,7 @@ local function collect_media(modname)
-- Traverse files (collect media)
local filenames = minetest.get_dir_list(folderpath, false)
for _, filename in pairs(filenames) do
local _, ext = modlib.file.get_extension(filename)
local _, ext = split_extension(filename)
if media_extensions[ext] then
media[filename] = table.concat({folderpath, filename}, "/")
end