Comparing entity tables

Things that already exist in the current mod API
Post Reply
User avatar
rk84
Filter Inserter
Filter Inserter
Posts: 556
Joined: Wed Feb 13, 2013 9:15 am
Contact:

Comparing entity tables

Post by rk84 »

I would like to avoid saving multiple references to same entity. so some method comparing them would be nice. ID mayby?

-methods like findentities and getselected always create new table for entity. So can't use reference number.
-some entities can be stacked. so position is not fit for all cases.
Test mode
Searching Flashlight
[WIP]Fluid handling expansion
[WIP]PvP gamescript
[WIP]Rocket Express
Autofill: The torch has been pass to Nexela

ficolas
Smart Inserter
Smart Inserter
Posts: 1068
Joined: Sun Feb 24, 2013 10:24 am
Contact:

Re: Comparing entity tables

Post by ficolas »

as a workarround you can try to move it/modify it some way, then compare that thing, then move it back, and compare the original position.

kovarex
Factorio Staff
Factorio Staff
Posts: 8170
Joined: Wed Feb 06, 2013 12:00 am
Contact:

Re: Comparing entity tables

Post by kovarex »

There is method equals. It checks if those references point to the same entity.

User avatar
rk84
Filter Inserter
Filter Inserter
Posts: 556
Joined: Wed Feb 13, 2013 9:15 am
Contact:

Re: Comparing entity tables

Post by rk84 »

@ficolas
thanks for suggestion.

@kovarex
ah I remember seeing that in Lua/force wikipage. Thank you.
Test mode
Searching Flashlight
[WIP]Fluid handling expansion
[WIP]PvP gamescript
[WIP]Rocket Express
Autofill: The torch has been pass to Nexela

Post Reply

Return to “Already exists”