I get that, but in the code on display, "entity" was used as index, and it was also treated as entity (with the entity.valid check). This wouldn't work, that was my point.Qon wrote: βThu Aug 20, 2020 8:49 amWhat you expected gives you a list-like table.Pi-C wrote: βThu Aug 20, 2020 7:28 amDo you really use the complete entity as table index?
[/code]
What I'd have expected isTake that with a grain of salt, though -- I'm still decaffeinated.Code: Select all
global = { things_I_care_about = { [1] = {entity, true} [2] = {entity, true} β¦ } }
What I used was a map-like table.
"entire entity", not really, it's a reference, or just a typed number.
Some entities will have entity.unit_number. Entities based on simple-entity won't, but just yesterday, I've learned about script.register_on_entity_destroyed which would allow you to assign unique IDs to any entity that doesn't have a unit_number.Edit: I would have used entity.index as key if there was something like that. I thought there was, but apparently not. It would not be a list since they keys are non-contiguous. But it would be values that can be printed to console.