TL;DR
Now I need something to link the in game entity and the lua data in backend from my scenario in BOTH direction.What ?
It's very easy to assign an entity to a variable in lua:local entities = surface.find_entities_filtered(...)
(some directive to find out the entity I want, then)
some_lua_table.in_game_entity = the_entity_I_want
Then it's very easy to call any function from backend:
script.bla bla bla(on_tick, function(event)
some_lua_table.in_game_entity.some built in function from the cpp code.
But it's very hard to find the lua table from the entity.
Now I made a container to do this for me. But this container works only for the non-moveable entities with integer coordinate.
If I what to find some data associated to a moveable entity, or some entity with floating number as coordinate, I have to iterate from the backend, which is always way slower than a direct dereference with a pointer from entity returned from some function in luasurface.
Or, do people do this with tag system?