From 07820fa37c93e8c158b419cc68595ee817468595 Mon Sep 17 00:00:00 2001 From: Jean-Patrick Guerrero Date: Sun, 29 Sep 2019 15:24:04 +0200 Subject: [PATCH] Re-add accidentally removed --- API.md | 4 ++++ init.lua | 10 ++++++++++ 2 files changed, 14 insertions(+) diff --git a/API.md b/API.md index a6e3df8..f19f475 100644 --- a/API.md +++ b/API.md @@ -82,6 +82,10 @@ craftguide.add_recipe_filter("Hide secretstuff", function(recipes) end) ``` +#### `craftguide.set_recipe_filter(name, function(recipe, player))` + +Removes all recipe filters and adds a new one. + #### `craftguide.remove_recipe_filter(name)` Removes the recipe filter with the given name. diff --git a/init.lua b/init.lua index 95dfae3..46aff49 100644 --- a/init.lua +++ b/init.lua @@ -251,6 +251,16 @@ function craftguide.add_recipe_filter(name, f) recipe_filters[name] = f end +function craftguide.set_recipe_filter(name, f) + if not is_str(name) then + return err("craftguide.set_recipe_filter(): name missing") + elseif not is_func(f) then + return err("craftguide.set_recipe_filter(): function missing") + end + + recipe_filters = {[name] = f} +end + function craftguide.remove_recipe_filter(name) recipe_filters[name] = nil end