Module:ClassMemoryCategoryList

local class_link = require('Module:Superclass')._class_link

local p = {}

--% This function generates a list of classes by their memory category. --: (string) the list of classes function p.list_classes_by_memory_category local memory_categories = {} local uncategorized_classes = {} for _, class in pairs(mw.loadData("Module:APIDump").data.Classes) do       if class.MemoryCategory then if not memory_categories[class.MemoryCategory] then memory_categories[class.MemoryCategory] = {} end table.insert(memory_categories[class.MemoryCategory], class.Name) else table.insert(uncategorized_classes, class) end end local sorted_memory_categories = {} for memory_category in pairs(memory_categories) do       table.insert(sorted_memory_categories, memory_category) end table.sort(sorted_memory_categories) local output = "" for _, memory_category in ipairs(sorted_memory_categories) do       output = output .. "== " .. memory_category .. " ==\n" table.sort(memory_categories[memory_category]) for _, class_name in ipairs(memory_categories[memory_category]) do           output = output .. "* " .. class_link{class=class_name} .. "\n" end end return output end

return p