diff utils.lua @ 73:a77fd9d06ba4

Use the new internal data format everywhere
author contrebasse
date Sat, 14 May 2011 20:55:49 +0200
parents 4f9fd025112b
children 9d487333bf10
line wrap: on
line diff
--- a/utils.lua	Sat May 14 20:28:05 2011 +0200
+++ b/utils.lua	Sat May 14 20:55:49 2011 +0200
@@ -214,3 +214,24 @@
 	end
 	print("restored")
 end
+
+function A.isRecipeUnique(itemData)
+	local unique = true
+	
+	-- Check if the item is made by only one recipe. If not, return
+	if #itemData>1 then
+		local spellLink
+		for _,v in ipairs(itemData) do
+			if not spellLink then
+				spellLink = v.spellLink
+			else
+				if v.spellLink ~= spellLink then
+					unique = nil
+					break
+				end
+			end
+		end
+	end
+	
+	return unique
+end