Re-add accidentally removed

This commit is contained in:
Jean-Patrick Guerrero 2019-09-29 15:24:04 +02:00
parent 29f87f2607
commit 07820fa37c
2 changed files with 14 additions and 0 deletions

4
API.md
View File

@ -82,6 +82,10 @@ craftguide.add_recipe_filter("Hide secretstuff", function(recipes)
end) end)
``` ```
#### `craftguide.set_recipe_filter(name, function(recipe, player))`
Removes all recipe filters and adds a new one.
#### `craftguide.remove_recipe_filter(name)` #### `craftguide.remove_recipe_filter(name)`
Removes the recipe filter with the given name. Removes the recipe filter with the given name.

View File

@ -251,6 +251,16 @@ function craftguide.add_recipe_filter(name, f)
recipe_filters[name] = f recipe_filters[name] = f
end 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) function craftguide.remove_recipe_filter(name)
recipe_filters[name] = nil recipe_filters[name] = nil
end end