Notifications
Clear all

[Closed] Filter selected Items from array

Hi,

I got an array:

ArrLights = lights as array

I now want to delete the objects which i have selected (eg my selected light sources) from the array. How do i do that?

Alternatively is there any way to collect all the lights in that array EXCEPT the ones I selected?

2 Replies

The way I do it is just like this. It searches the array you made for each object in the selection,
and if that object is found, remove it from the other array.

	for Obj in ArrLights do 
 	(
 	   for o in selection do 
 		(
 		  local theSource = finditem ArrLights o
 		  if theSource !=0 do deleteitem ArrLights theSource
 		)
 	)

Ok, realized how to do it faster/better.

LightArr = for o in lights where o.isSelected == false  collect o