From 4a384017c7838235dc5a2f5e68442c8dff003f0c Mon Sep 17 00:00:00 2001 From: BlackMATov Date: Sun, 16 Mar 2025 23:23:56 +0700 Subject: [PATCH] reduce the number of local variables --- evolved.lua | 38 +++++++++++++++++--------------------- 1 file changed, 17 insertions(+), 21 deletions(-) diff --git a/evolved.lua b/evolved.lua index b17c318..fe6b7f3 100644 --- a/evolved.lua +++ b/evolved.lua @@ -126,16 +126,12 @@ local __query_sorted_excludes = {} ---@type table', __lua_table_concat(items, ', ')) + return string.format('<%s>', table.concat(items, ', ')) end ---@param self table @@ -840,11 +836,11 @@ function __debug_mts.chunk_fragment_set_mt.__tostring(self) local items = {} ---@type string[] for fragment, fragment_index in __lua_pairs(self) do - items[fragment_index] = __lua_string_format('(%s -> %d)', + items[fragment_index] = string.format('(%s -> %d)', __id_name(fragment), fragment_index) end - return __lua_string_format('{%s}', __lua_table_concat(items, ', ')) + return string.format('{%s}', table.concat(items, ', ')) end ---@param self evolved.fragment[] @@ -852,11 +848,11 @@ function __debug_mts.chunk_fragment_list_mt.__tostring(self) local items = {} ---@type string[] for fragment_index, fragment in __lua_ipairs(self) do - items[fragment_index] = __lua_string_format('(%d -> %s)', + items[fragment_index] = string.format('(%d -> %s)', fragment_index, __id_name(fragment)) end - return __lua_string_format('[%s]', __lua_table_concat(items, ', ')) + return string.format('[%s]', table.concat(items, ', ')) end ---@param self table @@ -864,11 +860,11 @@ function __debug_mts.chunk_component_indices_mt.__tostring(self) local items = {} ---@type string[] for component_fragment, component_index in __lua_pairs(self) do - items[component_index] = __lua_string_format('(%s -> %d)', + items[component_index] = string.format('(%s -> %d)', __id_name(component_fragment), component_index) end - return __lua_string_format('{%s}', __lua_table_concat(items, ', ')) + return string.format('{%s}', table.concat(items, ', ')) end ---@param self evolved.storage[] @@ -876,11 +872,11 @@ function __debug_mts.chunk_component_storages_mt.__tostring(self) local items = {} ---@type string[] for component_index, component_storage in __lua_ipairs(self) do - items[component_index] = __lua_string_format('(%d -> #%d)', + items[component_index] = string.format('(%d -> #%d)', component_index, #component_storage) end - return __lua_string_format('[%s]', __lua_table_concat(items, ', ')) + return string.format('[%s]', table.concat(items, ', ')) end ---@param self evolved.fragment[] @@ -888,11 +884,11 @@ function __debug_mts.chunk_component_fragments_mt.__tostring(self) local items = {} ---@type string[] for component_index, component_fragment in __lua_ipairs(self) do - items[component_index] = __lua_string_format('(%d -> %s)', + items[component_index] = string.format('(%d -> %s)', component_index, __id_name(component_fragment)) end - return __lua_string_format('[%s]', __lua_table_concat(items, ', ')) + return string.format('[%s]', table.concat(items, ', ')) end --- @@ -3397,7 +3393,7 @@ local function __phase_process(phase) local cycled_system_mark = sorting_marks[cycled_system_mark_index] if cycled_system_mark == 1 then - sorting_cycle_path = __lua_string_format('%s -> %s', + sorting_cycle_path = string.format('%s -> %s', sorting_cycle_path, cycled_system) if cycled_system == dependency then