Module:GameInfo

From Little Tail Wiki
Revision as of 08:23, 23 November 2024 by Meguumin (talk | contribs) (Created page with "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 ) :addHeade...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Lua error at line 19: data must be either of type string or number.

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( 'Release date(s)', args.releasedate )
	:addRow( 'Publisher', args.publisher )
	:addRow( 'Developer', args.developer )
    :addRow( 'System(s)', args.systems )
    :addRow( 'Genre', args.genre )
    :addRow( 'Number of players', args.numofplayers )
    :addRow( 'Rating', args.rating )

    
     return retval
    end

return p