Module:GameInfo

From Little Tail Wiki
Revision as of 23:14, 23 November 2024 by Meguumin (talk | contribs)
Module:GameInfo

Tail Concerto logo (IMAGE REQUIRED)
Info.
Developer(s) X
Publisher(s) X
Producer(s) X
Designer(s) X
Artist(s) X
Writer(s) X
Composer(s) X
Platform(s) X
Genre X
Number of players X
Rating X
Release date(s) X
Director(s) X
Website Optional

The GameInfo infobox serves as a quick rundown of the article's featured videogame.

Infoboxes are put together via Capiunto, which calls upon a Lua-based module. This keeps infoboxes clean and easy to form as long as all required rows are present. Failure to fill all required rows will throw an error over the page.

Usage

{{GameInfo
| headerstyle = (defaults to background-color:grey)
| image       = [[File:TailConcerto Logo.png|200px]]
| caption     =  Tail Concerto logo (IMAGE REQUIRED)
| ("Info.")
| developers = X
| publishers = X
| directors = X
| producers = X
| designers = X
| artists = X
| writers = X
| composers = X
| platforms = X
| genre = X
| numplayers = X
| rating = X
| releasedates = X
| website = only if applicable
}}

local capiunto = require 'capiunto'

local p = {}

function p.main(frame)
	local args = frame:getParent().args
	local headerStyle
	if args.headerstyle and args.headerstyle ~= '' then
		headerStyle = string.format('background-color:%s;', args.headerstyle)
	else
		headerStyle = 'background-color:grey;'
	end
	local retval = capiunto.create( {
		title = tostring(mw.title.getCurrentTitle()) ,
		headerStyle = headerStyle, 
	} )
	:addImage( args.image, args.caption )
	:addHeader( 'Info.' )
	:addRow( 'Developer(s)', args.developers )
	:addRow( 'Publisher(s)', args.publishers )
	:addRow( 'Producer(s)', args.producers )
	:addRow( 'Designer(s)', args.designers )
	:addRow( 'Artist(s)', args.artists )
	:addRow( 'Writer(s)', args.writers )
	:addRow( 'Composer(s)', args.composers )
	:addRow( 'Platform(s)', args.platforms )
	:addRow( 'Genre', args.genre )
	:addRow( 'Number of players', args.numplayers )
	:addRow( 'Rating', args.rating )
	:addRow( 'Release date(s)', args.releasedates )

if args.directors then retval:addRow( 'Director(s)', args.directors ) end
if args.website then retval:addRow( 'Website', args.website ) end


    
     return retval
    end

return p