Entities vs. EntIndexes?

Alright, so I’m making a very large table that is going to be indexing entities, and giving them values. I am receiving the values in the form of entity objects, and need to store numbers in the table for them. At the moment, I am receiving the entity, using Entity:EntIndex() and indexing the table with the resulting integer. This also means that when I need to call the table slot, I have to go Entity:EntIndex() again and use that integer to get the table’s value. However, is this actually a decent idea that is saving me time? Or should I simply be indexing the table with the entity object in the first place?

You should just index by the entity object. I’m pretty sure if the entity gets removed then the object would be NULL even if another entity took over the entity index spot.

Not only did you answer my question, you also saved me from my own stupidity. Thank you.

Good to know! On a related note is it better to send entities trough usermessages and console commands or would the index be lighter? I’m guessing there’s no difference but I want to make sure.

I’m not 100% sure that entities are not automatically transferered by index anyways. [sp] If not, garry needs to rethink his code :P[/sp]