Page 1 of 1

[15.34] renamed entities don't have a position

Posted: Sat Sep 16, 2017 11:57 pm
by quyxkh
Do

Code: Select all

/c script.on_event(defines.events.on_entity_renamed, function(e) game.print(e.position.x) end)
and rename a train station.

I don't see how to identify which train station was renamed if I don't have a position for it, there can be many with the old name, if I'm blindspotting on something there I'd be happy with whatever workaround I've missed.

Re: [15.34] renamed entities don't have a position

Posted: Sun Sep 17, 2017 12:35 am
by Rseding91
Thanks for the report but it looks like you don't understand how events actually work.

"position" is not part of that event: http://lua-api.factorio.com/latest/even ... ty_renamed

You want e.entity.position

Re: [15.34] renamed entities don't have a position

Posted: Sun Sep 17, 2017 12:56 am
by quyxkh
The evils of single-character variable names, I use `e` for entity in other routines so often I just didn't notice the pun here. Sorry and thanks.