What is the best way to determine that all objects have been deleted?

Hello! I have in the game through the factory create 10 characters. When resizing the game window, I delete 10 characters, and then re-create them in other positions, but I need to first make sure that the previous 10 characters have been deleted. Now I use this code, but I think it is not the best solution.

function update()
	if NEED_TO_CREATE and not next(my_characters) then
		NEED_TO_CREATE = false

An additional question, how can I make it so that go is always at the top of the game? Like a gui anchor