add checks for gate definition errors
This commit is contained in:
parent
94bb85c31d
commit
1dce343c87
@ -26,6 +26,7 @@ function GateDefinition:new(objref, name, description, init, logic, input, globa
|
||||
o.init = initfunc() or function()end
|
||||
else
|
||||
print("Error loading init func for ".. (name or ""))
|
||||
print(init)
|
||||
end
|
||||
|
||||
local logicfunc = loadstring(tostring(logic))
|
||||
@ -41,6 +42,7 @@ function GateDefinition:new(objref, name, description, init, logic, input, globa
|
||||
o.input = inputfunc() or function()end
|
||||
else
|
||||
print("Error loading input function for " .. (name or ""))
|
||||
print(input)
|
||||
end
|
||||
|
||||
local globalfunc = loadstring(tostring(global))
|
||||
@ -48,6 +50,7 @@ function GateDefinition:new(objref, name, description, init, logic, input, globa
|
||||
globalfunc()
|
||||
else
|
||||
print("Error loading global function for ".. (name or ""))
|
||||
print(global)
|
||||
end
|
||||
|
||||
setmetatable(o, self)
|
||||
|
@ -145,7 +145,10 @@ while 1 do
|
||||
i = i + 4
|
||||
elseif data[i] == "G" then
|
||||
local objref = tonumber(data[i+1])
|
||||
local definition = sim:getdefinitionbyref(tonumber(data[i+2])) or GateDefinition
|
||||
local definition = sim:getdefinitionbyref(tonumber(data[i+2]))
|
||||
|
||||
assert(definition, "No gate definition for objref "..objref)
|
||||
|
||||
local position = vectotable(data[i+3])
|
||||
local rotation = tonumber(data[i+4])
|
||||
local gate = definition:constructgate(objref, position, rotation)
|
||||
|
Loading…
x
Reference in New Issue
Block a user