make net info show ports on

This commit is contained in:
Redo0 2021-05-25 15:17:03 -05:00
parent d151ab688c
commit 8fe789eade

View File

@ -259,14 +259,20 @@ while 1 do
local wire = Simulation.getwirebyref(sim, objref) local wire = Simulation.getwirebyref(sim, objref)
if wire then if wire then
local numportsi = 0; for k, wire2 in pairs(Wire.getgroup(wire).in_ports ) do numportsi = numportsi+1 end local group = Wire.getgroup(wire)
local numportso = 0; for k, wire2 in pairs(Wire.getgroup(wire).out_ports) do numportso = numportso+1 end local numwires = 0; for k, wire2 in pairs(group.wires ) do numwires = numwires +1 end
local numwires = 0; for k, wire2 in pairs(Wire.getgroup(wire).wires ) do numwires = numwires +1 end local numportsi = 0; for k, port in pairs(group.in_ports ) do numportsi = numportsi+1 end
local numportso = 0; local numportson=0;
for k, port in pairs(group.out_ports) do
numportso = numportso+1
if Port.getstate(port) then numportson = numportson+1 end
end
info = "\\c5Net " .. tostring(wire.group):match("table: 0x(.+)"):upper() .. "\n" .. (Wire.getgroup(wire).state and "\\c2On" or "\\c0Off") .. "\n" .. info = "\\c5Net " .. tostring(group):match("table: 0x(.+)"):upper() .. "\n" .. (Wire.getgroup(wire).state and "\\c2On" or "\\c0Off") .. "\n" ..
"Wires: "..numwires.."\n".. "Wires: "..numwires.."\n"..
"In Ports: " ..numportsi.."\n".. "In Ports: " ..numportsi.."\n"..
"Out Ports: "..numportso "Out Ports: "..numportso.."\n"..
"Out Ports On: "..numportson
; ;
end end