remove colon syntax from oop
This commit is contained in:
17
sim/port.lua
17
sim/port.lua
@@ -1,3 +1,4 @@
|
||||
|
||||
PortTypes = {
|
||||
output = 0,
|
||||
input = 1
|
||||
@@ -16,7 +17,7 @@ Port = {
|
||||
logictype = 1,
|
||||
}
|
||||
|
||||
function Port:new(type, direction, position, causeupdate)
|
||||
function Port.new(self, type, direction, position, causeupdate)
|
||||
local o = {
|
||||
type = type,
|
||||
direction = direction,
|
||||
@@ -31,35 +32,35 @@ function Port:new(type, direction, position, causeupdate)
|
||||
return o
|
||||
end
|
||||
|
||||
function Port:setstate(state)
|
||||
function Port.setstate(self, state)
|
||||
if state ~= self.state then
|
||||
self.state = state
|
||||
sim:queuegroup(self.group)
|
||||
Simulation.queuegroup(sim, self.group)
|
||||
end
|
||||
end
|
||||
|
||||
function Port:setinputstate(state)
|
||||
function Port.setinputstate(self, state)
|
||||
if state ~= self.state then
|
||||
self.state = state
|
||||
if self.causeupdate then
|
||||
sim:queuegate(self.gate)
|
||||
Simulation.queuegate(sim, self.gate)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function Port:getconnectionposition()
|
||||
function Port.getconnectionposition(self)
|
||||
local offset = PortDirections[self.direction]
|
||||
return {self.position[1]+offset[1], self.position[2]+offset[2], self.position[3]+offset[3]}
|
||||
end
|
||||
|
||||
function Port:isrising()
|
||||
function Port.isrising(self)
|
||||
if self.group == nil then
|
||||
return false
|
||||
end
|
||||
return self.group.state and (self.group.updatetick == sim.currenttick)
|
||||
end
|
||||
|
||||
function Port:isfalling()
|
||||
function Port.isfalling(self)
|
||||
if self.group == nil then
|
||||
return false
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user