LUA interaction with custom map brushes/entities

Can somebody give me a tip on how to get LUA to recognise when a user ‘uses’ an entity or brush on a map that i make?

or