refactor: Format Lua code

This commit is contained in:
Lucas Schwiderski 2023-07-22 14:39:51 +02:00
parent 9b8f07d125
commit 6ef4c2e094
Signed by: lucas
GPG key ID: AA12679AAA6DF4D8

View file

@ -18,7 +18,7 @@ local function patch_mod_loading_state()
-- A necessary override. -- A necessary override.
-- The original does not proxy `dt` to `_state_update`, but we need that. -- The original does not proxy `dt` to `_state_update`, but we need that.
StateBootSubStateBase.update = function (self, dt) StateBootSubStateBase.update = function(self, dt)
local done, error = self:_state_update(dt) local done, error = self:_state_update(dt)
local params = self._params local params = self._params
@ -39,7 +39,7 @@ local function patch_mod_loading_state()
local StateBootLoadMods = class("StateBootLoadMods", "StateBootSubStateBase") local StateBootLoadMods = class("StateBootLoadMods", "StateBootSubStateBase")
StateBootLoadMods.on_enter = function (self, parent, params) StateBootLoadMods.on_enter = function(self, parent, params)
log("StateBootLoadMods", "Entered") log("StateBootLoadMods", "Entered")
StateBootLoadMods.super.on_enter(self, parent, params) StateBootLoadMods.super.on_enter(self, parent, params)
@ -54,18 +54,17 @@ local function patch_mod_loading_state()
} }
end end
StateBootLoadMods._state_update = function (self, dt) StateBootLoadMods._state_update = function(self, dt)
local state = self._state local state = self._state
local package_manager = self._package_manager local package_manager = self._package_manager
if state == "load_package" and package_manager:update() then if state == "load_package" and package_manager:update() then
log("StateBootLoadMods", "Packages loaded, loading mods") log("StateBootLoadMods", "Packages loaded, loading mods")
self._state = "load_mods" self._state = "load_mods"
local mod_loader = require("scripts/mods/dml/init") local ModLoader = require("scripts/mods/dml/init")
self._mod_loader = mod_loader
local mod_data = require("scripts/mods/mod_data") local mod_data = require("scripts/mods/mod_data")
mod_loader:init(mod_data, self._parent:gui()) self._mod_loader = ModLoader:new(mod_data, self._parent:gui())
elseif state == "load_mods" and self._mod_loader:update(dt) then elseif state == "load_mods" and self._mod_loader:update(dt) then
log("StateBootLoadMods", "Mods loaded, exiting") log("StateBootLoadMods", "Mods loaded, exiting")
return true, false return true, false
@ -110,7 +109,7 @@ local require_store = {}
-- This token is treated as a string template and filled by DTMM during deployment. -- This token is treated as a string template and filled by DTMM during deployment.
-- This allows hiding unsafe I/O functions behind a setting. -- This allows hiding unsafe I/O functions behind a setting.
-- It's also a valid table definition, thereby degrading gracefully when not replaced. -- It's also a valid table definition, thereby degrading gracefully when not replaced.
local is_io_enabled = {{is_io_enabled}} -- luacheck: ignore 113 local is_io_enabled = { { is_io_enabled } } -- luacheck: ignore 113
local lua_libs = { local lua_libs = {
debug = debug, debug = debug,
os = { os = {