blockgame/mods/bg_api/util_item.lua
trans_soup d197e1f1e3 move item_matches into api.
move function `item_matches` from `bg_crafting` into `bg_api`, since
it'll be useful in many other places.
2023-10-17 15:02:39 +02:00

12 lines
311 B
Lua

function blockgame.item_matches (name, options)
return blockgame.any(options, function (option)
if name == option then return true end
if blockgame.starts_with(option, "group:") then
local group = string.sub(option, 7)
return minetest.get_item_group(name, group) > 0
end
return false
end)
end