Lua Question - missing unit?
Posted: Thu Jun 09, 2016 8:52 pm
Hi guys
Need some more Lua help
To delete/change sides/assign mission etc for a complete squadron with similar names, I'm using something CK helped me with a while back:
for i=1,24 do ScenEdit_DeleteUnit({Side='Test', Name="58 FS 'Gorillas' #"..i,}) end
Which works really well - until there is a missing unit! Say #8 (of 24) has been killed; Lua will carry on with the function until #7 then return an error message and stop.
Is there a way to bypass missing units in this function so that Lua skips the missing dude, and carries on with the rest in the series?
Thanks
B
Need some more Lua help
To delete/change sides/assign mission etc for a complete squadron with similar names, I'm using something CK helped me with a while back:
for i=1,24 do ScenEdit_DeleteUnit({Side='Test', Name="58 FS 'Gorillas' #"..i,}) end
Which works really well - until there is a missing unit! Say #8 (of 24) has been killed; Lua will carry on with the function until #7 then return an error message and stop.
Is there a way to bypass missing units in this function so that Lua skips the missing dude, and carries on with the rest in the series?
Thanks
B
Thank you sir - works like a charm