remove colon syntax from oop
This commit is contained in:
33
sim/gate.lua
33
sim/gate.lua
@@ -1,6 +1,7 @@
|
||||
|
||||
Gate = {}
|
||||
|
||||
function Gate:new(objref, definition)
|
||||
function Gate.new(self, objref, definition)
|
||||
local o = {
|
||||
objref = objref,
|
||||
definition = definition,
|
||||
@@ -11,33 +12,33 @@ function Gate:new(objref, definition)
|
||||
return o
|
||||
end
|
||||
|
||||
function Gate:addport(port)
|
||||
function Gate.addport(self, port)
|
||||
self.ports[#self.ports+1] = port
|
||||
port.gate = self
|
||||
end
|
||||
|
||||
function Gate:getportstate(index)
|
||||
function Gate.getportstate(self, index)
|
||||
return self.ports[index].state
|
||||
end
|
||||
|
||||
function Gate:setportstate(index, state)
|
||||
self.ports[index]:setstate(state)
|
||||
function Gate.setportstate(self, index, state)
|
||||
Port.setstate(self.ports[index], state)
|
||||
end
|
||||
|
||||
function Gate:initdata()
|
||||
function Gate.initdata(self)
|
||||
self.data = {}
|
||||
end
|
||||
|
||||
function Gate:getdata()
|
||||
function Gate.getdata(self)
|
||||
return self.data
|
||||
end
|
||||
|
||||
function Gate:getportisrising(index)
|
||||
return self.ports[index]:isrising()
|
||||
function Gate.getportisrising(self, index)
|
||||
return Port.isrising(self.ports[index])
|
||||
end
|
||||
|
||||
function Gate:getportisfalling(index)
|
||||
return self.ports[index]:isfalling()
|
||||
return Port.isfalling(self.ports[index])
|
||||
end
|
||||
|
||||
-- function Gate:cb(...)
|
||||
@@ -52,15 +53,15 @@ end
|
||||
-- sim:queuecallback(self, str)
|
||||
-- end
|
||||
|
||||
function Gate:cb(...)
|
||||
sim:queuecallback(self, ...)
|
||||
function Gate.cb(self, ...)
|
||||
Simulation.queuecallback(sim, self, ...)
|
||||
end
|
||||
|
||||
function Gate:queue(delay)
|
||||
sim:queuegatelater(self, delay)
|
||||
function Gate.queue(self, delay)
|
||||
Simulation.queuegatelater(sim, self, delay)
|
||||
end
|
||||
|
||||
function Gate:testlogic(n)
|
||||
function Gate.testlogic(self, n)
|
||||
--local time = os.clock()
|
||||
--for i = 1, n do
|
||||
-- self.definition.logic(self)
|
||||
@@ -68,6 +69,6 @@ function Gate:testlogic(n)
|
||||
--client:send("TEST\t" .. (os.clock()-time) .. "\n")
|
||||
end
|
||||
|
||||
function Gate:gettick()
|
||||
function Gate.gettick(self)
|
||||
return sim.currenttick
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user