vector.clamp

vector.clamp (vec: vector, min: vector, max: vector) -> vector

Applies math.clamp to every component of the input vector.

Example

vector.clamp(vector(1,1,1), vector(1,1,1), vector(1,1,1))
Raw function spec json
{
  "def": "func",
  "name": "clamp",
  "energy": 0,
  "must_use": true,
  "sleep": 0,
  "signatures": [
    {
      "def": "signature",
      "result": [
        {
          "name": "",
          "def": "result",
          "desc": "",
          "variadic": false,
          "type": [
            {
              "def": "simple",
              "value": "vector"
            }
          ],
          "optional": false
        }
      ],
      "args": [
        {
          "def": "arg",
          "name": "vec",
          "desc": "",
          "type": [
            {
              "def": "simple",
              "value": "vector"
            }
          ],
          "variadic": false,
          "optional": false
        },
        {
          "def": "arg",
          "name": "min",
          "desc": "",
          "type": [
            {
              "def": "simple",
              "value": "vector"
            }
          ],
          "variadic": false,
          "optional": false
        },
        {
          "def": "arg",
          "name": "max",
          "desc": "",
          "type": [
            {
              "def": "simple",
              "value": "vector"
            }
          ],
          "variadic": false,
          "optional": false
        }
      ]
    }
  ],
  "desc": "Applies `math.clamp` to every component of the input vector.",
  "link": "https://luau.org/library#bit32-library#:~:text=function%20bit32.clamp",
  "takesSelf": false,
  "private": false
}

< Back to vector