Setting an entity's back to face a wall

I have a tv screen, which will get spawned around the map.
How can I get it to change it’s angle in hammer or having it’s back face the wall with lua?

You could do a trace in the direction of the wall perhaps.

[lua]
local trc = {start=self:GetPos(), endpos = self:GetPos() + (self:GetForward() * - 200), filter=self}
local tr = util.TraceLine(trc)
if tr.Hit then
self:SetAngles(tr.HitNormal:Angle())
end
[/lua]

Bearing in mind that will only work if the entity has its back to a wall.

But I didn’t really understand the question, so that might be completely off!

the entity always faces north, no matter how much I rotate it in hammer.
let me try that code