Quantcast

Moved the code to load all item info to load-all-item-info.lua

Kevin Lyles [01-07-12 - 17:17]
Moved the code to load all item info to load-all-item-info.lua
Filename
load-all-item-info.lua
splice-item-info.lua
diff --git a/load-all-item-info.lua b/load-all-item-info.lua
new file mode 100644
index 0000000..41706dd
--- /dev/null
+++ b/load-all-item-info.lua
@@ -0,0 +1,26 @@
+local LENGTH = 5
+local INCREMENT = 1000
+
+local function padInteger(num)
+	return string.rep("0", LENGTH - tostring(num):len()) .. num
+end
+
+item_info = {}
+
+local i = 0
+local start = padInteger(i)
+local finish = padInteger(i + INCREMENT - 1)
+
+local func = loadfile(string.format("scanned/item-info-%s_%s.lua", start, finish))
+while func do
+	func()
+
+	for k, v in pairs(_G[string.format("IS_item_info_%s_%s", start, finish)]) do
+		item_info[k] = v
+	end
+
+	i = i + INCREMENT
+	start = padInteger(i)
+	finish = padInteger(i + INCREMENT - 1)
+	func = loadfile(string.format("scanned/item-info-%s_%s.lua", start, finish))
+end
diff --git a/splice-item-info.lua b/splice-item-info.lua
index c498b45..f305ee4 100644
--- a/splice-item-info.lua
+++ b/splice-item-info.lua
@@ -1,30 +1,4 @@
-local LENGTH = 5
-local INCREMENT = 1000
-
-local function padInteger(num)
-	return string.rep("0", LENGTH - tostring(num):len()) .. num
-end
-
-item_info = {}
-
-local i = 0
-local start = padInteger(i)
-local finish = padInteger(i + INCREMENT - 1)
-
-local func = loadfile(string.format("scanned/item-info-%s_%s.lua", start, finish))
-while func do
-	func()
-
-	for k, v in pairs(_G[string.format("IS_item_info_%s_%s", start, finish)]) do
-		item_info[k] = v
-	end
-
-	i = i + INCREMENT
-	start = padInteger(i)
-	finish = padInteger(i + INCREMENT - 1)
-	func = loadfile(string.format("scanned/item-info-%s_%s.lua", start, finish))
-end
-
+loadfile("load-all-item-info.lua")()
 loadfile("sort.lua")()

 io.output("full-item-info")