Limit
From Director Online Wiki
-- @ Name: limit() -- @ Copyright: (c)2009 Josh Chunick -- @ Licence: WTFPL, linked here: http://sam.zoy.org/wtfpl/ -- @ Description: Takes an input value and limits it within the defined range. -- @ Category: math -- @ Dependencies: none -- @ Parameters: -- input [integer, float, string] - the input value. -- minVal [integer, float, string] - the minimum value to test the input against. Must be less than maxVal. -- maxVal [integer, float, string] - the maximum value to test the input against. Must be greater than minVal. -- @ Usage: -- example #1 -- ---------- -- put limit(15, 1, 10) -- -- 10 -- -- example #2 -- ---------- -- put limit("pasta", "perfume", "prune") -- -- "perfume" on limit input, minVal, maxVal if (maxVal < minVal) and (the runmode = "Author") then alert("Parameter Error: maxVal is less than minVal.") end if return min(max(input, minVal), maxVal) end