Two changes to main.lua (read comments)

Disallowed trying to load a directory
Required funcs.lua at the beginning of the program so mod makers don't have to anywhere else
This commit is contained in:
Ishaan Bhardwaj 2021-08-15 23:50:00 -04:00
parent c7d0034f9b
commit c58018dd51

View File

@ -10,6 +10,7 @@ function love.load()
require "load.bigint"
require "load.version"
loadSave()
require "funcs"
require "scene"
--config["side_next"] = false
@ -36,14 +37,14 @@ function initModules()
game_modes = {}
mode_list = love.filesystem.getDirectoryItems("tetris/modes")
for i=1,#mode_list do
if(mode_list[i] ~= "gamemode.lua" and mode_list[i] ~= "unrefactored_modes") then
if(mode_list[i] ~= "gamemode.lua" and string.sub(mode_list[i], -4) == ".lua") then
game_modes[#game_modes+1] = require ("tetris.modes."..string.sub(mode_list[i],1,-5))
end
end
rulesets = {}
rule_list = love.filesystem.getDirectoryItems("tetris/rulesets")
for i=1,#rule_list do
if(rule_list[i] ~= "ruleset.lua" and rule_list[i] ~= "unrefactored_rulesets") then
if(rule_list[i] ~= "ruleset.lua" and string.sub(rule_list[i], -4) == ".lua") then
rulesets[#rulesets+1] = require ("tetris.rulesets."..string.sub(rule_list[i],1,-5))
end
end