`mcl_craftguide`: Autoformat and fix misleading variable names

This commit is contained in:
AFCMS 2022-11-22 23:34:45 +01:00
parent a3fbb2e0c9
commit f8e934c1dd
Signed by untrusted user: AFCMS
GPG Key ID: 8720389A25B652E3
1 changed files with 63 additions and 63 deletions

View File

@ -24,11 +24,11 @@ local ESC = M.formspec_escape
local S = M.get_translator("mcl_craftguide")
local maxn, sort, concat, insert, copy =
table.maxn, table.sort, table.concat, table.insert,
table.maxn, table.sort, table.concat, table.insert,
table.copy
local fmt, find, gmatch, match, sub, split, lower =
string.format, string.find, string.gmatch, string.match,
string.format, string.find, string.gmatch, string.match,
string.sub, string.split, string.lower
local min, max, floor, ceil = math.min, math.max, math.floor, math.ceil
@ -192,7 +192,7 @@ function mcl_craftguide.set_recipe_filter(name, f)
assert(name, func .. "filter name missing")
assert(f and type(f) == "function", func .. "filter function missing")
recipe_filters = {[name] = f}
recipe_filters = { [name] = f }
end
function mcl_craftguide.get_recipe_filters()
@ -305,7 +305,7 @@ local function get_item_usages(item)
end
if fuel_cache[item] then
usages[#usages + 1] = {type = "fuel", width = 1, items = {item}}
usages[#usages + 1] = { type = "fuel", width = 1, items = { item } }
end
return usages
@ -373,7 +373,7 @@ local function get_recipes(item, data, player)
end
local function get_burntime(item)
return get_result({method = "fuel", width = 1, items = {item}}).time
return get_result({ method = "fuel", width = 1, items = { item } }).time
end
local function cache_fuel(item)
@ -430,13 +430,13 @@ local function get_tooltip(item, groups, cooktime, burntime)
tooltip = groupstr
else
local groupstr, c = {}, 0
local grouptable, c = {}, 0
for i = 1, #groups do
c = c + 1
groupstr[c] = colorize(gcol, groups[i])
grouptable[c] = colorize(gcol, groups[i])
end
groupstr = concat(groupstr, ", ")
groupstr = concat(grouptable, ", ")
tooltip = S("Any item belonging to the groups: @1", groupstr)
end
else
@ -475,7 +475,7 @@ local function get_recipe_fs(data, iY)
end
local rows = ceil(maxn(recipe.items) / width)
local rightest, btn_size, s_btn_size = 0, 1.1
local rightest, btn_size, s_btn_size = 0, 1.1, nil
local btn_lab = data.show_usages and
ESC(S("Usage @1 of @2", data.rnum, #data.recipes)) or
@ -741,7 +741,7 @@ mcl_craftguide.add_search_filter("groups", function(item, groups)
for i = 1, #groups do
local group = groups[i]
if not itemdef.groups[group] then
has_groups = nil
has_groups = false
break
end
end