How to get entity name?

If I have this entity in world, how can I get its entity name (like item_healthkit)?
This is probably dumb but I need help.

EDIT: I mean getting the entity name ingame, not through code. sorry for the confusion

You could use


 print( LocalPlayer():GetEyeTrace().Entity ) 

on a Think hook, and aim to the entity and the entity name will be printed to your console

Whoops, I think I didn’t state it correctly, I meant if I was in the game.

Entity.GetClass

Well I guess I’m better creating a SWEP that grabs entity name then actually trying to find out a way that makes me get its name without some hassle. Thanks everyone.
I’ll leave this on for a while if someone actually knows a in-game way, but I’ll close it later.

Get my “Easy Entity Inspector” Sandbox tool and it will allow you do it with little to no hassle.

You can also just enter this into your console while looking at the entity in question.


lua_run print( LocalPlayer():GetEyeTrace().Entity )

Woah, thanks man. Saving lives!