How do I store an enemy index on a variable?

Hi all!

What I want here is to store the index (troop index of course) of the enemy Im targeting.

thanks!

EDIT: Nm, I hink i got it:
Code:
$gameTroop.allMembers().indexOf(target)

CLOSED.

This thread is being closed, due to being solved. If for some reason you would like this thread re-opened, please report this post and leave a message why. Thank you.

Original thread: https://forums.rpgmakerweb.com/threads/how-do-i-store-an-enemy-index-on-a-variable.104208/