Page 1 of 1
Weird table access error
Posted: Mon Nov 14, 2016 8:47 pm
by Fatmice
http://pastebin.com/CNXkDPTx
The error only happens when my mod entity is adjacent to another of my mod entity. I do not see what is causing this error. Could anyone help me spot the error please?

Re: Weird table access error
Posted: Mon Nov 14, 2016 9:11 pm
by Klonan
It seems you are searching for generator in this global roster, but for many records this does not exist:
Code: Select all
if entity_name == "reactor-steam-generator-01" then
for k,entity_table in pairs(global.ROSTER) do
if entity_id == entity_table.record.steamgenerator.id then
entity_table[3][1].destroy()
entity_table[4][1].destroy()
table.remove(global.ROSTER, k)
return
end
end
end
This looks for record.steamgenerator
However on line 905, a record is added using turbine generator:
Code: Select all
turbine_generator["record"] = {
["turbinegenerator"] = {
["id"] = event.created_entity.unit_number,
["position"] = {
["x"] = event.created_entity.position.x,
["y"] = event.created_entity.position.y
}
},
Which means for this record, steamgenerator is nil
Re: Weird table access error
Posted: Tue Nov 15, 2016 1:14 am
by Fatmice
Indeed, I thought of the same on my drive home today. Well, easy fix then. Thanks Klonan
