14.12.2022, 12:49
1. You can tag all objects with a common tag and populate mapping tables based on object names. Keep in mind that the script must be restarted manually when new objects are tagged so the mapping tables are updated.
2. Use string.split(str, '_'):
2. Use string.split(str, '_'):
Code:
str = 'Floor_1_Room_302_Device_3'
chunks = str:split('_')
log(chunks)
--[[
* table:
[1]
* string: Floor
[2]
* string: 1
[3]
* string: Room
[4]
* string: 302
[5]
* string: Device
[6]
* string: 3
]]