Module:Player/Flag: Difference between revisions
From TwogPedia
(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...") |
No edit summary |
||
Line 3: | Line 3: | ||
local cargo = mw.ext.cargo | local cargo = mw.ext.cargo | ||
function pFlag.makeFlag(playerId) | function pFlag.makeFlag(flagArg, playerId, gameCategory) | ||
-- Look up Cargo table for nationality string | -- Look up Cargo table for nationality string | ||
if flagArg then | |||
return Flags.icon( flagArg, gameCategory) | |||
end | |||
local tables = 'Players' | local tables = 'Players' | ||
local fields = '_pageName, nationality' | local fields = '_pageName, nationality' |
Revision as of 18:23, 7 September 2022
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(flagArg, playerId, gameCategory)
-- Look up Cargo table for nationality string
if flagArg then
return Flags.icon( flagArg, gameCategory)
end
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
No categories