Logic Machine Forum
export and create copy with new objects - Printable Version

+- Logic Machine Forum (https://forum.logicmachine.net)
+-- Forum: LogicMachine eco-system (https://forum.logicmachine.net/forumdisplay.php?fid=1)
+--- Forum: Scripting (https://forum.logicmachine.net/forumdisplay.php?fid=8)
+--- Thread: export and create copy with new objects (/showthread.php?tid=724)



export and create copy with new objects - akn - 07.04.2017

I have 50 objects with addresses starting 3/0 / ...

I want to create a copy of objects with addresses (3/1 ...), while adding a certain text to the new name (for example: the old name "light on/off", the new name "light on/off status")

thank you in advance


RE: export and create copy with new objects - admin - 07.04.2017

Code:
-- from 3/0/1 to 3/0/50
addrstart = 1
addrend = 50

for addr = addrstart, addrend do
  obj = grp.find('3/0/' .. addr)

  if obj then
    grp.create({
      datatype = obj.datatype,
      address = '3/1/' .. addr,
      name = obj.name .. ' status',
    })
  end
end