update logic functions to remove metatable OOP

This commit is contained in:
Redo
2020-09-10 12:58:25 -05:00
parent 4095d193ff
commit ab19de7333
206 changed files with 22726 additions and 3544 deletions

View File

@@ -24,7 +24,7 @@ local function getBit(gate, val)
local printid = gate.valReceived
local printname = textbrick2_idxToPrint[printid]
gate:cb(printname)
Gate.cb(gate, printname)
--print("", "set print", string.format("%02x", printid), printname)
end
@@ -37,7 +37,7 @@ local function getBit(gate, val)
end
local function changeTo(gate, val)
local tick = gate:gettick()
local tick = Gate.gettick(gate)
local ticks = tick-gate.lastTickChanged
local bits = math.min(ticks, 10)
@@ -49,9 +49,9 @@ local function changeTo(gate, val)
end
return function(gate)
if gate.ports[1]:isrising() then
if Gate.getportisrising(gate, 1) then
changeTo(gate, 0)
elseif gate.ports[1]:isfalling() then
elseif Gate.getportisfalling(gate, 2) then
changeTo(gate, 1)
end
end