diff options
author | JP Guerrero <jeanpatrick.guerrero@gmail.com> | 2016-12-13 22:32:23 +0100 |
---|---|---|
committer | JP Guerrero <jeanpatrick.guerrero@gmail.com> | 2016-12-13 22:37:21 +0100 |
commit | f321647a6bba536f2a3715ae1d22436b2c3f68e3 (patch) | |
tree | fcdaa4fc29fad64e1b1b8b272b1dad7461c7d4c9 /init.lua | |
parent | 7e1b2b82603c23e2a2952f65541bc0acd141979f (diff) |
Fix list size counting
Diffstat (limited to 'init.lua')
-rw-r--r-- | init.lua | 6 |
1 files changed, 3 insertions, 3 deletions
@@ -209,7 +209,7 @@ function craftguide:recipe_in_inv(player_name, item_name) end function craftguide:get_items(player_name) - local items_list, data, list_size = {}, datas[player_name] + local items_list, data, list_size = {}, datas[player_name], 0 for name, def in pairs(minetest.registered_items) do local is_fuel = minetest.get_craft_result({ method="fuel", width=1, items={name}}).time > 0 @@ -219,7 +219,6 @@ function craftguide:get_items(player_name) (def.name:find(data.filter, 1, true) or def.description:lower():find(data.filter, 1, true)) then - list_size = #items_list if progressive_mode then local _, player_has_item = self:recipe_in_inv(player_name, name) @@ -229,12 +228,13 @@ function craftguide:get_items(player_name) else items_list[list_size+1] = name end + list_size = #items_list end end table.sort(items_list) data.items = items_list - data.size = list_size or 0 + data.size = list_size data.pagemax = max(1, ceil(data.size / ipp)) end |