Angle:SnapTo broken?

In my lua file I have


print( Angle(0,0,0):SnapTo("p",0))

and I get this error



[ERROR] gamemodes/-snip-/init.lua:13: attempt to call method 'SnapTo' (a nil value)


I tried it in other files, it seems like SnapTo isn’t a thing…
but i could have sworn it was:

any ideas?

I added that, it should go through on the next update, or it should be active in the dev-version.

This is the code for it if you want to use it before the update:


//
// Snaps Angle to nearest... Josh 'Acecool' Moser
//
local META_ANGLE = FindMetaTable( "Angle" );
function META_ANGLE:SnapTo( _component, _snap_degrees )
	if ( _snap_degrees == 0 ) then ErrorNoHalt( "The snap degrees must be non-zero.
" ); return self; end
	if ( !self[ _component ] ) then ErrorNoHalt( "You must choose a valid component of Angle( p || pitch, y || yaw, r || roll ) to snap such as Angle( 80, 40, 30 ):SnapTo( \"p\", 90 ):SnapTo( \"y\", 45 ):SnapTo( \"r\", 40 ); and yes, you can keep adding snaps.
" ); return self; end

	self[ _component ] = math.Round( self[ _component ] / _snap_degrees ) * _snap_degrees;
	self[ _component ] = math.NormalizeAngle( self[ _component ] );

	return self;
end

You can’t use 0 for the snap-to angle, it needs to snap every X degrees… So, for example, the physgun when shift/rotating, it snaps the yaw, pitch and roll at 45 degree intervals.

Great thank you!