Last active
April 6, 2020 17:29
-
-
Save gabyfle/ae524dea8634e2b0247057aa386776b4 to your computer and use it in GitHub Desktop.
Load materials from path
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- Loads all materials in a path | |
-- @param string path: path to analyse | |
-- @return table: a table containing every materials depending on | |
local function loadMaterials(path) | |
local files, directory = file.Find(path .. '*', 'GAME') | |
local materials = {} | |
for _, dir in pairs(directory) do -- launch the function in the other directories | |
table.Merge(materials, loadMaterials(path .. dir .. '/')) | |
end | |
for _, f in pairs(files) do | |
materials[string.GetFileFromFilename(f)] = Material(path .. f) | |
end | |
return materials | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment