is there a better way to do this, this code is really ugly and I want to change it.
I think making dictionary for this one like
local dict = {
[100] = { -- this is the value of the TotalTurns
IndustrialEra = false;
EraName = "IndustrialEra"
}
}
and run loop in the function
sorry i wrote this on mobile so it could be confusing
1 Like
can you give me a example? ------
I don’t really understand ------------
Might look like this
local dict = {
{ Max = 145, Value = false, Name = "ModernEra" },
{ Max = 100, Value = false, Name = "Industrial" }
-- Descending order
}
for _, Object in pairs(dict) do
if TotalTurns.Value >= Object.Max and Object.Value == false then
Object.Value = true
EraModule.ChangeEra(Object.Name)
end
end
4 Likes