diff --git a/findall.lua b/findall.lua index 2e72e20..f2942d8 100644 --- a/findall.lua +++ b/findall.lua @@ -456,10 +456,10 @@ function export_to_file(result, export) export_file:write('"char";"storage";"item";"quantity"\n') - for item_id, item_list in pairs(result) do - local names = get_item_names_by_id(item_id) - for char_name, storage_list in pairs(item_list) do - for storage_name, quantity in pairs(storage_list) do + for char_name, storage_list in pairs(result) do + for storage_name, item_list in pairs(storage_list) do + for item_id, quantity in pairs(item_list) do + local names = get_item_names_by_id(storage_name, item_id) export_file:write('"' .. char_name .. '";"' .. storage_name .. '";"' .. names.name .. '";"' .. quantity .. '"\n') end end