Module:Test: Difference between revisions

From Resonite Wiki
mNo edit summary
mNo edit summary
Line 25: Line 25:
   :tag( 'tr' )
   :tag( 'tr' )
   :tag( 'td' ) -- The Input binding post
   :tag( 'td' ) -- The Input binding post
     :attr( 'rowspan', '2')  
     :attr( 'rowspan', '2' )
    :attr( 'color', 'red' )
     :done()
     :done()
   :tag( 'td' ) -- The Input name
   :tag( 'td' ) -- The Input name
Line 32: Line 33:
   :tag( 'td' )
   :tag( 'td' )
     :wikitext( 'test' )
     :wikitext( 'test' )
    :done()
    
    
end
end


return p
return p

Revision as of 03:14, 13 January 2024

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

local p = {}

function p.ProtoFlux( frame )
 local inputsDecode = mw.text.jsonDecode( frame.args.Inputs );
 local outputsDecode = mw.text.jsonDecode( frame.args.Outputs );
 local numInputs = #inputsDecode;
 local numOuputs = #outputsDecode;

 local protofluxContainer = mw.html.create( 'table' )
 
 protofluxContainer
  :tag( 'tr' )
   :tag( 'th' )
    :wikitext(frame.args.Name);

 CreateIORow(protofluxContainer, inputsDecode[1], outputsDecode[1]);

 return tostring(protofluxContainer);

end

-- Each Input/Output row is really 2 rows high. 
function CreateIORow(Container, Input, Output)
 Container
  :tag( 'tr' )
   :tag( 'td' ) -- The Input binding post
    :attr( 'rowspan', '2' )
    :attr( 'color', 'red' )
    :done()
   :tag( 'td' ) -- The Input name
    :wikitext( Input.Name .. ' = ' .. Input.Type )
    :done()
   :tag( 'td' )
    :wikitext( 'test' )
    :done()
   
end

return p