diff options
author | JP Guerrero <jeanpatrick.guerrero@gmail.com> | 2018-04-27 22:55:30 +0200 |
---|---|---|
committer | JP Guerrero <jeanpatrick.guerrero@gmail.com> | 2018-04-27 23:01:03 +0200 |
commit | d95cdee33d6565c255a1936a10fbb0290ab1e2e4 (patch) | |
tree | 03399628b958b6ba3c8108505342ba7acebb2f60 | |
parent | c630c9097004cd618d4aca08480f991b9ba6c4a9 (diff) |
Cache results only if searched 2 times (to avoid silly searches)
-rw-r--r-- | init.lua | 9 |
1 files changed, 7 insertions, 2 deletions
@@ -343,8 +343,13 @@ function craftguide:get_filter_items(data, player) if not data.items then data.init_filter_items = filtered_list end - elseif filter ~= "" and not datas.searches[filter] then - datas.searches[filter] = filtered_list + elseif filter ~= "" then + -- Cache the results only if searched 2 times + if datas.searches[filter] == nil then + datas.searches[filter] = false + else + datas.searches[filter] = filtered_list + end end data.items = filtered_list |