From 40b5f8725ad34d0e287af116f20739ec577fdd1f Mon Sep 17 00:00:00 2001 From: Jean-Patrick Guerrero Date: Wed, 13 Feb 2019 14:04:13 +0100 Subject: [PATCH] Fix some glitch --- init.lua | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/init.lua b/init.lua index a69051f..65dd37e 100644 --- a/init.lua +++ b/init.lua @@ -70,23 +70,23 @@ local function table_merge(t, t2) end local function table_diff(t, t2) - local t3 = {} + local hash = {} for i = 1, #t do local v = t[i] - t3[v] = true + hash[v] = true end for i = 1, #t2 do local v = t2[i] - t3[v] = nil + hash[v] = nil end local ret, c = {}, 0 for i = 1, #t do local v = t[i] - if t3[v] then + if hash[v] then c = c + 1 ret[c] = v end @@ -730,8 +730,13 @@ local function on_receive_fields(player, fields) data.show_usages = not data.show_usages end + local recipes = get_recipes(item, data, player) + if not recipes then + return + end + data.query_item = item - data.recipes = get_recipes(item, data, player) + data.recipes = recipes data.rnum = 1 show_fs(player, name)