Hello I wanted to make a craft system, but noticed that the problem is that my code does not work as it should
local Table = { "Apple" , "?" , "Apple"}
local Recipes = {
ThreeApple = {
"Apple";
"Apple";
"Apple";
}
}
local function FindItemGivenRecipet()
local CraftingItems = Table
for k,v in pairs(Recipes) do
local Compare = true;
for i = 1 ,#v do
if v[i] ~= CraftingItems[i] then
Compare = false;
break;
end
if Compare then
return k;
end
end
end
end
local g = FindItemGivenRecipet()
print(g)
If these two values match, the rest are ignored and returned, or maybe even return the wrong table that you need, I need the function to return only when all values match. You can offer your versions how to do it.

1 comment
There may be no understanding because I'm in a hurry