update logic functions to remove metatable OOP
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user