Skip to content

Commit

Permalink
clarify main.lua content loading a bit
Browse files Browse the repository at this point in the history
  • Loading branch information
RandomCatDude committed Jan 5, 2025
1 parent b16cceb commit 7d6faa7
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions main.lua
Original file line number Diff line number Diff line change
Expand Up @@ -7,21 +7,26 @@ NAMESPACE = "ssr"

local init = function()
local folders = {
"Misc", -- contains utility functions, so load first
"Misc", -- contains utility functions that other code depends on, so load first
"Actors",
"Gameplay",
"Survivors",
"Items",
}

for _, folder in ipairs(folders) do
local names = path.get_files(path.combine(PATH, folder))
for _, name in ipairs(names) do
if string.sub(name, -4, -1) == ".lua" then
require(name)
-- NOTE: this includes filepaths within subdirectories of the above folders
local filepaths = path.get_files(path.combine(PATH, folder))
for _, filepath in ipairs(filepaths) do
-- filter for files with the .lua extension, incase there's non-lua files
if string.sub(filepath, -4, -1) == ".lua" then
require(filepath)
end
end
end

-- once we have loaded everything, enable hot/live reloading.
-- this variable may be used by content code to make sure it behaves correctly when hotloading
HOTLOADING = true
end
Initialize(init)
Expand Down

0 comments on commit 7d6faa7

Please sign in to comment.