Last active
July 2, 2017 07:53
-
-
Save ProjectSky/11bf6eb2a98c1512e7c7360cb005ca8f to your computer and use it in GitHub Desktop.
Export all ltem list script
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
local modName = "Hydrocraft"; | |
local list = 0 | |
function run() | |
local w = getFileWriter("ModStats_"..modName); | |
local count = {}; | |
local types = {}; | |
for v in DataManager.Objects do | |
if v.IsMod then | |
if count[v.ObjectType.Name] then | |
count[v.ObjectType.Name] = count[v.ObjectType.Name]+1; | |
else | |
count[v.ObjectType.Name] = 1; | |
end | |
if v.ObjectType.Name=="item" then | |
if v.HasKey("Type") then | |
local t = v.GetFirstKey("DisplayName").Value | |
if types[t] then | |
types[t].count = types[t].count+1; | |
table.insert(types[t].items, v.name); | |
else | |
types[t] = { count = 1, items = { v.name } }; | |
end | |
end | |
end | |
end | |
end | |
for k,v in pairs(types) do | |
for _,itm in pairs(v.items) do | |
list = list + 1 | |
w.WriteLine('<tr>') | |
w.WriteLine('<td data-title="ID">' .. tostring(list) .. '</td>'); | |
w.WriteLine('<td data-title="Name">' .. tostring(k) .. '</td>'); | |
w.WriteLine('<td data-title="Code">' .. tostring(itm) .. '</td>'); | |
w.WriteLine('</tr>') | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment