Use # instead of next for array tables

This commit is contained in:
Paul Ouellette 2019-01-19 01:37:00 -05:00
parent 1e49c065f2
commit d5556ab964
1 changed files with 3 additions and 3 deletions

View File

@ -363,7 +363,7 @@ local function make_formspec(player_name)
",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) .. "]"
if not next(data.items) then
if #data.items == 0 then
fs[#fs + 1] = fmt("label[%f,%f;%s]",
(data.iX / 2) - 1,
2,
@ -713,7 +713,7 @@ local function on_receive_fields(player, fields)
recipes = apply_progressive_filters(recipes, player)
end
if not next(recipes) then
if #recipes == 0 then
return
end
end
@ -892,7 +892,7 @@ if not progressive_mode then
if is_fuel and no_recipes then
recipes = get_item_usages(node_name)
if next(recipes) then
if #recipes > 0 then
data.show_usages = true
end
end