diff --git a/sim/main.lua b/sim/main.lua index 3590021..eaa29c9 100644 --- a/sim/main.lua +++ b/sim/main.lua @@ -151,7 +151,7 @@ while 1 do local position = vectotable(data[i+3]) local rotation = tonumber(data[i+4]) - local gate = GateDefitinion.constructgate(definition, objref, position, rotation) + local gate = GateDefinition.constructgate(definition, objref, position, rotation) Simulation.addgate(sim, gate) --print(gate.objref) @@ -192,7 +192,7 @@ while 1 do if not portd.direction then print(line) end end - local definition = GateDefinition.new(GateDefitinion, objref, name, desc, init, logic, input, global, ports) + local definition = GateDefinition.new(GateDefinition, objref, name, desc, init, logic, input, global, ports) Simulation.addgatedefinition(sim, definition) i = i + 8 + numports*5 @@ -251,11 +251,11 @@ while 1 do local info = "" if obj.logictype == 0 then - local numportsi = 0; for k, wire in pairs(obj.group.in_ports ) do numportsi = numportsi+1 end - local numportso = 0; for k, wire in pairs(obj.group.out_ports) do numportso = numportso+1 end - local numwires = 0; for k, wire in pairs(obj.group.wires ) do numwires = numwires +1 end + local numportsi = 0; for k, wire in pairs(Wire.getgroup(obj).in_ports ) do numportsi = numportsi+1 end + local numportso = 0; for k, wire in pairs(Wire.getgroup(obj).out_ports) do numportso = numportso+1 end + local numwires = 0; for k, wire in pairs(Wire.getgroup(obj).wires ) do numwires = numwires +1 end - info = "\\c5Net " .. tostring(obj.group):match("table: 0x(.+)"):upper() .. "\n" .. (obj.group.state and "\\c2On" or "\\c0Off") .. "\n" .. + info = "\\c5Net " .. tostring(obj.group):match("table: 0x(.+)"):upper() .. "\n" .. (Wire.getgroup(obj).state and "\\c2On" or "\\c0Off") .. "\n" .. "Wires: "..numwires.."\n".. "In Ports: " ..numportsi.."\n".. "Out Ports: "..numportso diff --git a/sim/wire.lua b/sim/wire.lua index 073242f..1fa409b 100644 --- a/sim/wire.lua +++ b/sim/wire.lua @@ -39,10 +39,10 @@ function Wire.getobjref(self) return self.objref end -function Wire.getlayer() +function Wire.getlayer(self) return self.layer end -function Wire.getbounds(wire) +function Wire.getbounds(self) return self.bounds end