hmm, I think I got a solution. Not sure yet.

What if you used ent_next and kept looping through every single entity in the level, and then calling that ent_nextlight with the entity retrieved from the previous funciton. You could also then maybe somehow do a check if the retrieved light is already on the list, if yes; skip it, else, add it.

Not sure though, just something that came to my mind.