math.Clamp

From GMod Wiki

Revision as of 02:34, 29 October 2009 by Crazy Quebecer (Talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search
Function
Syntax math.Clamp( Number Value, Number Lower Bound, Number Upper Bound )
Where is this used?
Description:
Forces a number into the specified boundaries
Returns: Number
Part of Library: math
Realm: NewerShared.png
BBCode Link: [b][url=http://wiki.garrysmod.com/?title=Math.Clamp]Math.Clamp [img]http://wiki.garrysmod.com/favicon.ico[/img][/url][/b]



Example

DescriptionDemonstration of use
Used onNewerShared.png
Code
local a = math.Clamp( input, -100, 100 )
OutputVariable a will be no less than -100 and no more than 100.
Personal tools
Namespaces
Variants
Actions
Navigation
Lua Scripting
Functions
Hooks
Toolbox