Module:Test: Difference between revisions

From Resonite Wiki
mNo edit summary
mNo edit summary
Line 4: Line 4:
  local inputsDecode = mw.text.jsonDecode( frame.args.Inputs );
  local inputsDecode = mw.text.jsonDecode( frame.args.Inputs );
  local outputsDecode = mw.text.jsonDecode( frame.args.Outputs );
  local outputsDecode = mw.text.jsonDecode( frame.args.Outputs );
local numInputs = rowCount(inputsDecode);
local numOuputs = rowCOunt(outputsDecode);


  local protofluxContainer = mw.html.create( 'table' )
  local protofluxContainer = mw.html.create( 'table' )
Line 25: Line 27:
  end
  end
  return tostring( protofluxContainer );
  return tostring( protofluxContainer );
end
function CreateIORow(Container, InputName, InputType, OutputName, OutputType)
end
function rowCount(tbl)
local count = 0
for k,v in pairs(tbl) do count = count + 1 end
return count
end
end


return p
return p

Revision as of 02:53, 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 = rowCount(inputsDecode);
 local numOuputs = rowCOunt(outputsDecode);

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

 for k,v in pairs( inputsDecode ) do
  protofluxContainer
   :tag( 'tr' )
    :tag ('td' )
     :wikitext( k .. '=' .. v );
 end
 for k,v in pairs( outputsDecode ) do
    protofluxContainer
   :tag( 'tr' )
    :tag ('td' )
     :wikitext( k .. '=' .. v );
 end
 return tostring( protofluxContainer );
end

function CreateIORow(Container, InputName, InputType, OutputName, OutputType)
 
end

function rowCount(tbl)
 local count = 0
 for k,v in pairs(tbl) do count = count + 1 end
 return count
end

return p