Not exactly the same but:

[lua]local M = Matrix()

M:Translate(_pos)

M:Rotate(_ang)

M:Translate(pos)

M:Rotate(ang)

_pos = M:GetTranslation()

_ang = M:GetAngles()[/lua]

As I said in that other thread, matrices work a bit like a camera that you’d move and rotate in the world. A default matrix (returned by the Matrix() function) is equivalent to a camera at position (0, 0, 0) and angles (0, 0, 0). Any translation or rotation you apply to it is done relative to its current position and angles. So the order in which you apply the transformations is very important.

It might not give the exact same results as the code you posted. This is because Rotate actually performs three rotations (one for pitch, one for yaw and one for roll), and it doesn’t really tell you in which order it does them.

Also in Source, X is the forward axis, Y is the right axis and Z is the up axis. Therefore pitch is a rotation around the right axis, yaw is a rotation around the up axis and roll is a rotation around the forward axis. Get your axes right.