Toggle menu
Toggle preferences menu
Toggle personal menu
Not logged in
Your IP address will be publicly visible if you make any edits.

Module used to render shaderpack entries into a table, automatically sorted by their name. Entries must be specified in any order using Module:ShaderpackListEntry.

Example

{{#invoke:ShaderpackList|Render|data=[

{{#invoke:ShaderpackListEntry|Generic
|arg1 = value1
|arg2 = value2
}}

{{#invoke:ShaderpackListEntry|Generic
|arg1 = value1
|arg2 = value2
}}

{{#invoke:ShaderpackListEntry|Modrinth
|arg1 = value1
|arg2 = value2
}}

]}}

local list = {}

function list.Render(frame)
	local list_rows = mw.text.jsonDecode(frame.args.data, mw.text.JSON_TRY_FIXING)
	
	-- sort by name (only alphanumerical characters)
	table.sort(list_rows, function(a, b)
        return a[1]:gsub("%W", "") < b[1]:gsub("%W", "")
    end)
	
	local list_table = mw.html.create()
	
	list_table
		:wikitext([[{| class="wikitable wikitable--stripe sortable"]]):newline()
		:wikitext([[|- class="citizen-overflow-sticky-header"]]):newline()
		:wikitext([[! Name !! Style !! FPS Cost !! class="unsortable" | Version !! Last Update !! class="unsortable" | Links !! GPUs !! Loader !! Author !! MC Version]]):newline()
	
	for i = 1,#list_rows do
		list_table
			:wikitext('|-'):newline()
			:wikitext('| ' .. table.concat(list_rows[i], ' || ')):newline()
	end
	
	list_table:wikitext('|}')
	
	return list_table
end

return list
Contents