Module:Player/Flag

From TwogPedia
< Module:Player
Revision as of 18:17, 7 September 2022 by Couchor (talk | contribs) (Created page with "local Flags = require('Module:Flags') local pFlag = {} local cargo = mw.ext.cargo function pFlag.makeFlag(playerId) -- Look up Cargo table for nationality string mw.log('playerId') mw.log(playerId) local tables = 'Players' local fields = '_pageName, nationality' local cargoArgs = { where = '_pageName = "' .. playerId .. '"' } local results = cargo.query(tables, fields, cargoArgs) mw.log(results) mw.logObject(results) if #results > 0 then Flags.icon( mw.t...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Documentation for this module may be created at Module:Player/Flag/doc

local Flags = require('Module:Flags')
local pFlag = {}
local cargo = mw.ext.cargo

function pFlag.makeFlag(playerId) 
	-- Look up Cargo table for nationality string
	mw.log('playerId')
	mw.log(playerId)
	local tables = 'Players'
	local fields = '_pageName, nationality'
	local cargoArgs = {
		where = '_pageName = "' .. playerId .. '"'
	}
	local results = cargo.query(tables, fields, cargoArgs)
	mw.log(results)
	mw.logObject(results)
	if #results > 0 then
		Flags.icon( mw.text.split(results[1].nationality, ',')[1], gameCategory)
	else 
		return nil
	end
end

return pFlag