Ench. table : get rid of global matching

This commit is contained in:
jp 2015-12-24 11:49:04 +01:00
parent 7eaea64ce0
commit e80eeae854
2 changed files with 5 additions and 4 deletions

View File

@ -106,7 +106,7 @@ minetest.register_abm({
if obj and obj:get_luaentity() then if obj and obj:get_luaentity() then
local itemstring = obj:get_luaentity().itemstring:match("([%w_:]+)%s") local itemstring = obj:get_luaentity().itemstring:match("([%w_:]+)%s")
for _, ing in pairs(ingredients_list) do for _, ing in pairs(ingredients_list) do
if itemstring and ing == itemstring:match(ing) if itemstring and itemstring:match(ing)
and not minetest.serialize(ingredients):find(itemstring) then and not minetest.serialize(ingredients):find(itemstring) then
ingredients[#ingredients+1] = itemstring ingredients[#ingredients+1] = itemstring
end end

View File

@ -80,10 +80,11 @@ end
local function allowed(tool) local function allowed(tool)
for item, _ in pairs(minetest.registered_tools) do for item, _ in pairs(minetest.registered_tools) do
for t in item:gmatch("enchanted_"..tool) do if item:match("enchanted_"..tool) then
if t then return true end return true
end end
end end
return false return false
end end