Как правильно записать?

Sadow

Известный
Автор темы
1,438
592
Версия MoonLoader
Другое
Как правильно записать этот код? Чтобы не было говнокода.
Lua:
local pBool = false

if config["bool"]["timeDN"] == true then
            for a = 0, config["main"]["items"] do
                if config["period"]["time0" .. a] <= config["period"]["time1" .. a] then
                    for i = config["period"]["time0" .. a], config["period"]["time1" .. a] do
                        if getTimeOfDay() == i then
                            forceWeatherNow(config["period"]["weather0" .. a])
                        end
                    end
                elseif config["period"]["time0" .. a] > config["period"]["time1" .. a] then
                    for i = 0, config["period"]["time1" .. a] do
                        if getTimeOfDay() == i then
                            forceWeatherNow(config["period"]["weather0" .. a])
                        end
                        if i == config["period"]["time1" .. a] then
                            pBool = true
                        end
                    end
                end
                if pBool then
                    for i = config["period"]["time0" .. a], config["main"]["timeL"] do
                        if getTimeOfDay() == i then
                            forceWeatherNow(config["period"]["weather0" .. a])
                        end
                        if i == config["main"]["timeL"] then
                            pBool = false
                        end
                    end
                end
            end
        end
 
Последнее редактирование:
  • Нравится
  • Ха-ха
Реакции: YarikVL и nishino akane