How to construct a virtual-signal from to entity names and how to split it?
Posted: Wed Oct 27, 2021 11:49 pm
I'm building virtual signals that are a combination of a locomotive and a wagon, for example "locomotive" and "artillery-wagon" for a vanilla example. With modes I have things like "locomotive-2" and "cargo-wagon-2".
I've starts by joining them with "-", so I get "train-locomotive-artillery-wagon". Then I split at "-" and take the 2nd and 3rd+4th parts to get the entities in vanilla. But with mods having "-" in the entity name that breaks for obvious reasons.
So how do I name my virtual signals so that I can later take them apart again to get the entity names?
Or how do I store a table of all signals with their source entity names in data.lua so control.lua can later access it?
I've starts by joining them with "-", so I get "train-locomotive-artillery-wagon". Then I split at "-" and take the 2nd and 3rd+4th parts to get the entities in vanilla. But with mods having "-" in the entity name that breaks for obvious reasons.
So how do I name my virtual signals so that I can later take them apart again to get the entity names?
Or how do I store a table of all signals with their source entity names in data.lua so control.lua can later access it?