stop setting metatables on objects
This commit is contained in:
parent
4cf2231a01
commit
e92cc50186
@ -10,7 +10,7 @@ FFI.cdef[[
|
||||
};
|
||||
]]
|
||||
|
||||
function Gate.new(self, objref, definition)
|
||||
function Gate.new(objref, definition)
|
||||
local o = {
|
||||
objref = objref,
|
||||
definition = definition,
|
||||
@ -18,8 +18,6 @@ function Gate.new(self, objref, definition)
|
||||
in_queue = false,
|
||||
logic = definition.logic,
|
||||
}
|
||||
setmetatable(o, self)
|
||||
self.__index = self
|
||||
return o
|
||||
end
|
||||
|
||||
|
@ -5,7 +5,7 @@ GateDefinition = {
|
||||
input = function(gate, argv) end
|
||||
}
|
||||
|
||||
function GateDefinition.new(self, objref, name, description, init, logic, input, global, ports)
|
||||
function GateDefinition.new(objref, name, description, init, logic, input, global, ports)
|
||||
|
||||
name = collapseescape(name)
|
||||
init = collapseescape(init)
|
||||
@ -53,13 +53,11 @@ function GateDefinition.new(self, objref, name, description, init, logic, input,
|
||||
print(global)
|
||||
end
|
||||
|
||||
setmetatable(o, self)
|
||||
self.__index = self
|
||||
return o
|
||||
end
|
||||
|
||||
function GateDefinition.constructgate(def, objref, position, rotation)
|
||||
local gate = Gate.new(Gate, objref, def)
|
||||
local gate = Gate.new(objref, def)
|
||||
|
||||
for i = 1, #def.ports do
|
||||
local portd = def.ports[i]
|
||||
@ -84,7 +82,7 @@ function GateDefinition.constructgate(def, objref, position, rotation)
|
||||
pos[2] = x
|
||||
end
|
||||
|
||||
Gate.addport(gate, Port.new(Port, type, dir, {position[1]+pos[1], position[2]+pos[2], position[3]+pos[3]}, portd.causeupdate))
|
||||
Gate.addport(gate, Port.new(type, dir, {position[1]+pos[1], position[2]+pos[2], position[3]+pos[3]}, portd.causeupdate))
|
||||
end
|
||||
|
||||
return gate
|
||||
|
@ -15,7 +15,7 @@ FFI.cdef[[
|
||||
};
|
||||
]]
|
||||
|
||||
function Group.new(self)
|
||||
function Group.new()
|
||||
local o = {
|
||||
state = false,
|
||||
fxstate = false,
|
||||
@ -32,8 +32,6 @@ function Group.new(self)
|
||||
nout_ports = 0,
|
||||
nin_ports = 0,
|
||||
}
|
||||
setmetatable(o, self)
|
||||
self.__index = self
|
||||
return o
|
||||
end
|
||||
|
||||
|
@ -149,7 +149,7 @@ while 1 do
|
||||
local max = vectotable(data[i+4])
|
||||
local bounds = {min[1], min[2], min[3], max[1], max[2], max[3]}
|
||||
|
||||
local wire = Wire.new(Wire, tonumber(data[i+1]), tonumber(data[i+2]), bounds)
|
||||
local wire = Wire.new(tonumber(data[i+1]), tonumber(data[i+2]), bounds)
|
||||
Simulation.addwire(sim, wire)
|
||||
|
||||
i = i + 4
|
||||
@ -202,7 +202,7 @@ while 1 do
|
||||
if not portd.direction then print(line) end
|
||||
end
|
||||
|
||||
local definition = GateDefinition.new(GateDefinition, objref, name, desc, init, logic, input, global, ports)
|
||||
local definition = GateDefinition.new(objref, name, desc, init, logic, input, global, ports)
|
||||
Simulation.addgatedefinition(sim, definition)
|
||||
|
||||
i = i + 8 + numports*5
|
||||
|
@ -29,7 +29,7 @@ FFI.cdef[[
|
||||
};
|
||||
]]
|
||||
|
||||
function Port.new(self, type, direction, position, causeupdate)
|
||||
function Port.new(type, direction, position, causeupdate)
|
||||
local o = {
|
||||
type = type,
|
||||
direction = direction,
|
||||
@ -39,8 +39,6 @@ function Port.new(self, type, direction, position, causeupdate)
|
||||
gate = nil,
|
||||
group = nil,
|
||||
}
|
||||
setmetatable(o, self)
|
||||
self.__index = self
|
||||
return o
|
||||
end
|
||||
|
||||
|
@ -219,7 +219,7 @@ function Simulation.connectwire(sim, wire)
|
||||
end
|
||||
|
||||
if Wire.getgroup(wire)==nil then
|
||||
Group.addwire(Group.new(Group), wire)
|
||||
Group.addwire(Group.new(), wire)
|
||||
end
|
||||
end
|
||||
|
||||
@ -233,7 +233,7 @@ function Simulation.connectport(sim, port)
|
||||
end
|
||||
|
||||
if Port.getgroup(port) == nil then
|
||||
Group.addport(Group.new(Group), port)
|
||||
Group.addport(Group.new(), port)
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -10,15 +10,13 @@ FFI.cdef[[
|
||||
};
|
||||
]]
|
||||
|
||||
function Wire.new(self, objref, layer, bounds)
|
||||
function Wire.new(objref, layer, bounds)
|
||||
local o = {
|
||||
objref = objref,
|
||||
layer = layer,
|
||||
group = nil,
|
||||
bounds = bounds,
|
||||
}
|
||||
setmetatable(o, self)
|
||||
self.__index = self
|
||||
return o
|
||||
end
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user