Opacity Mask with LUA?

Hi
Ok so, I am trying to make a custom HUD, the thing is that I am making a simulated 3D one, kind of like the HUD in Halo 3 ODST.
My problem is that I need to resize the health bar without distorting it (eg. when you get shot), so I thought I could use an Opacity mask, like the ones in Photoshop and Flash.
So could anyone give me a pretty detailed tutorial on how to do this in LUA? Because I’m a LUA noob.
Thanks.

BTW : I have already made textures.

well basically take the health of the player which is;

local health = LocalPlayer():Health()

then for the HP bar set the X Width to health*2 (*2 being a control over the length of the bar)

You can’t use masks in GMod. The best you can do is use surface.DrawPoly.

Ok thanks, I’ll try surface.DrawPoly