Module:TeamTotoSandbox: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
mNo edit summary |
||
(One intermediate revision by the same user not shown) | |||
Line 47: | Line 47: | ||
function p.main(frame) | function p.main(frame) | ||
-- [Process arguments. Header and image work ok, but | |||
-- additional logic is needed to separate the other args into rows] | |||
local args = require( 'Module:ProcessArgs' ).merge( true ) | local args = require( 'Module:ProcessArgs' ).merge( true ) | ||
local infoboxargs = { | local infoboxargs = { | ||
Line 52: | Line 54: | ||
['rows'] = args['rows'] | ['rows'] = args['rows'] | ||
} | } | ||
return infobox.infobox(args) | return infobox.infobox(args) | ||
end | end | ||
function h. | function h.addrow(row) | ||
-- [ Add html row with given table. I basically just rewrote | |||
-- Template:Infobox row in lua. likely needs to be refactored] | |||
local output = {} | |||
local label = row[1] | |||
local class = row['class'] | |||
local field = row[2] | |||
if label then | |||
output.append('! <div style="text-align:left" class="Searchaux"> '.. label .. '</div>\n') | |||
end | |||
output.append('|') | |||
if class then | |||
output.append('class="'.. class .. '"') | |||
end | |||
if not label then | |||
output.append('colspan="2"') | |||
end | |||
output.append('\n|' .. field .. '\n|-') | |||
end | end | ||
return p | return p |
Latest revision as of 21:20, 11 June 2025
local cargo = mw.ext.cargo
local util_cargo = require('Module:Cargo Utility')
local infobox = require('Module:Infobox')
local p = {}
local h = {}
function p.Declare(frame)
-- [ Declare ItemsTable ]
local tablename = 'ItemsTable'
local args = {
['BasePV']='Integer',
['MaxPV']='Integer',
['Vibro']='Boolean',
['PoweredPV']='Boolean',
['Damage']='String',
['UnpoweredDamage']='String',
['PrimaryDamageElement']='String',
['HP']='Integer',
['AV']='Integer',
['DV']='Integer',
['MA']='Integer',
['ToHit']='Integer',
['Skill']='String',
['ObjectID']='String',
['AgilityBonus']='Integer',
['StrengthBonus']='Integer',
['WillpowerBonus']='Integer',
['ToughnessBonus']='Integer',
['IntelligenceBonus']='Integer',
['EgoBonus']='Integer',
['Description']='Wikitext',
['WornOn']='String',
['UsesSlots']='List (,) of String',
['Healing']='String',
['HarvestedInto']='String',
['PreservedInto']='Page',
['PreservedQuantity']='Integer',
['ElementalDamage']='String',
['ElementalType']='String',
['JoinKey']='String'
}
local results = cargo.declare(table, args)
end
function p.main(frame)
-- [Process arguments. Header and image work ok, but
-- additional logic is needed to separate the other args into rows]
local args = require( 'Module:ProcessArgs' ).merge( true )
local infoboxargs = {
['class'] = 'qud-item-infobox',
['rows'] = args['rows']
}
return infobox.infobox(args)
end
function h.addrow(row)
-- [ Add html row with given table. I basically just rewrote
-- Template:Infobox row in lua. likely needs to be refactored]
local output = {}
local label = row[1]
local class = row['class']
local field = row[2]
if label then
output.append('! <div style="text-align:left" class="Searchaux"> '.. label .. '</div>\n')
end
output.append('|')
if class then
output.append('class="'.. class .. '"')
end
if not label then
output.append('colspan="2"')
end
output.append('\n|' .. field .. '\n|-')
end
return p