Use # instead of next for array tables
This commit is contained in:
parent
1e49c065f2
commit
d5556ab964
6
init.lua
6
init.lua
|
@ -363,7 +363,7 @@ local function make_formspec(player_name)
|
||||||
",0.12;0.8,0.8;craftguide_next_icon.png;next;]"
|
",0.12;0.8,0.8;craftguide_next_icon.png;next;]"
|
||||||
fs[#fs + 1] = "field[0.3,0.32;2.5,1;filter;;" .. mt.formspec_escape(data.filter) .. "]"
|
fs[#fs + 1] = "field[0.3,0.32;2.5,1;filter;;" .. mt.formspec_escape(data.filter) .. "]"
|
||||||
|
|
||||||
if not next(data.items) then
|
if #data.items == 0 then
|
||||||
fs[#fs + 1] = fmt("label[%f,%f;%s]",
|
fs[#fs + 1] = fmt("label[%f,%f;%s]",
|
||||||
(data.iX / 2) - 1,
|
(data.iX / 2) - 1,
|
||||||
2,
|
2,
|
||||||
|
@ -713,7 +713,7 @@ local function on_receive_fields(player, fields)
|
||||||
recipes = apply_progressive_filters(recipes, player)
|
recipes = apply_progressive_filters(recipes, player)
|
||||||
end
|
end
|
||||||
|
|
||||||
if not next(recipes) then
|
if #recipes == 0 then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -892,7 +892,7 @@ if not progressive_mode then
|
||||||
if is_fuel and no_recipes then
|
if is_fuel and no_recipes then
|
||||||
recipes = get_item_usages(node_name)
|
recipes = get_item_usages(node_name)
|
||||||
|
|
||||||
if next(recipes) then
|
if #recipes > 0 then
|
||||||
data.show_usages = true
|
data.show_usages = true
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue