Jump to content
Main menu
Main menu
move to sidebar
hide
Navigation
Main page
Recent changes
Random page
MediaWiki help
Creopedia
Search
Search
Appearance
Log in
Personal tools
Log in
View source for Module:Location/Components/GameTabsTable
Module
Discussion
English
Read
View source
View history
Tools
Tools
move to sidebar
hide
Actions
Read
View source
View history
General
What links here
Related changes
Special pages
Page information
Appearance
move to sidebar
hide
←
Module:Location/Components/GameTabsTable
require( 'strict' ) local locationTable = require( 'Module:Location/Components/Table' ) local gameTabs = require( 'Module:GameTabs' ) local games = require( 'Module:GameData' ).getGames() local p = {} --- Process wikitext args and group them by game. --- --- @param args table --- @return table local function processArgs( args ) local data = {} for _, game in ipairs( games ) do local gameId = game.id local locations = {} for i = 1, locationTable.MAX_WIKITEXT_LOCATIONS do local name = args[gameId .. '_name' .. i] local link = args[gameId .. '_link' .. i] local rate = args[gameId .. '_rate' .. i] local note = args[gameId .. '_note' .. i] if name then table.insert( locations, { name = name, link = link, rate = rate, note = note } ) end end if #locations > 0 then data[gameId] = locations end end return data end --- Get the wikitext for a game tab. --- --- @param gameData table --- @return string local function getGameTabWikitext( gameData ) local html = mw.html.create( 'div' ) html:addClass( 't-tabbedCard-table-container' ) :wikitext( locationTable._main( gameData ) ) return tostring( html ) end --- Wikitext entry point for the module. --- --- @param frame mw.frame --- @return string function p.main( frame ) local getArgs = require( 'Module:Arguments' ).getArgs return p._main( processArgs( getArgs( frame ) ) ) end --- Lua entry point for the module. --- --- @param data table --- @return string function p._main( data ) local gameTabsArgs = gameTabs.mapGameArgs( data, function ( locationsData, game ) return getGameTabWikitext( locationsData ) end ) gameTabsArgs.noPadding = true return gameTabs._main( gameTabsArgs ) end return p
Templates used on this page:
Template:Documentation
(
view source
)
Module:Location/Components/GameTabsTable/doc
(
view source
)
Return to
Module:Location/Components/GameTabsTable
.