How do I 'keep upright' on an entity through lua?

I want to spawn a prop with this attribute.

local ent = ents.Create("ent_name")

or maybe

im not really sure, im new to lua.

Find garrysmod/lua/autorun/properties/keep_upright.lua and find how to do it. I think it’s

local Phys = ent:GetPhysicsObjectNum( 0 )
if ( !IsValid( Phys ) ) then return end

local constraint = constraint.Keepupright( ent, Phys:GetAngles(), 0, 999999 )

[editline]25th February 2014[/editline]


The command is:

constraint.Keepupright( )

which is done server-side when you spawn the entity.

Although, I’ve heard it may not be working correctly.

Edit wow: I must’ve kept this page open for a while before responding, didn’t see the previous 2 O_o