Skip to main content

Vec4

Generic vector class

Properties

x

Vec4.x: number

Get/Set the x component of the vector

y

Vec4.y: number

Get/Set the y component of the vector

z

Vec4.z: number

Get/Set the z component of the vector

w

Vec4.w: number

Get/Set the w component of the vector

r

Vec4.r: number

Get/Set the r component of the vector

This is the same as the x component.

g

Vec4.g: number

Get/Set the g component of the vector

This is the same as the y component.

b

Vec4.b: number

Get/Set the b component of the vector

This is the same as the z component.

a

Vec4.a: number

Get/Set the a component of the vector

This is the same as the w component.

Functions

new

Vec4.new(
optionstable--

settings

) → ()

Create a new instance

Takes up to 4 numbers or Vec4 instances. Can also be a key value table (x/y/z/w or r/g/b/a).

v1 = Vec4.new { 1, 2, 3, 4 }
v2 = Vec4.new { x = 1, y = 2, z = 3, w = 4 }
v3 = Vec4.new { r = 1, g = 1, b = 1, a = 1 }
Show raw api
{
    "functions": [
        {
            "name": "new",
            "desc": "Create a new instance\n\nTakes up to 4 numbers or Vec4 instances.\nCan also be a key value table (x/y/z/w or r/g/b/a).\n\n```lua\nv1 = Vec4.new { 1, 2, 3, 4 }\nv2 = Vec4.new { x = 1, y = 2, z = 3, w = 4 }\nv3 = Vec4.new { r = 1, g = 1, b = 1, a = 1 }\n```",
            "params": [
                {
                    "name": "options",
                    "desc": "settings",
                    "lua_type": "table"
                }
            ],
            "returns": [],
            "function_type": "static",
            "source": {
                "line": 21,
                "path": "../../res/data/script/lib/system/scene3d_vec4.lua"
            }
        }
    ],
    "properties": [
        {
            "name": "x",
            "desc": "Get/Set the x component of the vector",
            "lua_type": "number",
            "source": {
                "line": 30,
                "path": "../../res/data/script/lib/system/scene3d_vec4.lua"
            }
        },
        {
            "name": "y",
            "desc": "Get/Set the y component of the vector",
            "lua_type": "number",
            "source": {
                "line": 37,
                "path": "../../res/data/script/lib/system/scene3d_vec4.lua"
            }
        },
        {
            "name": "z",
            "desc": "Get/Set the z component of the vector",
            "lua_type": "number",
            "source": {
                "line": 44,
                "path": "../../res/data/script/lib/system/scene3d_vec4.lua"
            }
        },
        {
            "name": "w",
            "desc": "Get/Set the w component of the vector",
            "lua_type": "number",
            "source": {
                "line": 51,
                "path": "../../res/data/script/lib/system/scene3d_vec4.lua"
            }
        },
        {
            "name": "r",
            "desc": "Get/Set the r component of the vector\n\nThis is the same as the x component.",
            "lua_type": "number",
            "source": {
                "line": 60,
                "path": "../../res/data/script/lib/system/scene3d_vec4.lua"
            }
        },
        {
            "name": "g",
            "desc": "Get/Set the g component of the vector\n\nThis is the same as the y component.",
            "lua_type": "number",
            "source": {
                "line": 69,
                "path": "../../res/data/script/lib/system/scene3d_vec4.lua"
            }
        },
        {
            "name": "b",
            "desc": "Get/Set the b component of the vector\n\nThis is the same as the z component.",
            "lua_type": "number",
            "source": {
                "line": 78,
                "path": "../../res/data/script/lib/system/scene3d_vec4.lua"
            }
        },
        {
            "name": "a",
            "desc": "Get/Set the a component of the vector\n\nThis is the same as the w component.",
            "lua_type": "number",
            "source": {
                "line": 87,
                "path": "../../res/data/script/lib/system/scene3d_vec4.lua"
            }
        }
    ],
    "types": [],
    "name": "Vec4",
    "desc": "Generic vector class",
    "source": {
        "line": 5,
        "path": "../../res/data/script/lib/system/scene3d_vec4.lua"
    }
}