Skip to main content

Vec2

Generic vector class

Properties

x

Vec2.x: number

Get/Set the x component of the vector

y

Vec2.y: number

Get/Set the y component of the vector

Functions

new

Vec2.new(
optionstable--

settings

) → ()

Create a new instance

Takes up to 2 numbers or Vec2 instances. Can also be a key value table (x/y).

v1 = Vec2.new { 1, 2 }
v2 = Vec2.new { x = 1, y = 2 }
Show raw api
{
    "functions": [
        {
            "name": "new",
            "desc": "Create a new instance\n\nTakes up to 2 numbers or Vec2 instances.\nCan also be a key value table (x/y).\n\n```lua\nv1 = Vec2.new { 1, 2 }\nv2 = Vec2.new { x = 1, y = 2 }\n```",
            "params": [
                {
                    "name": "options",
                    "desc": "settings",
                    "lua_type": "table"
                }
            ],
            "returns": [],
            "function_type": "static",
            "source": {
                "line": 20,
                "path": "../../res/data/script/lib/system/scene3d_vec2.lua"
            }
        }
    ],
    "properties": [
        {
            "name": "x",
            "desc": "Get/Set the x component of the vector",
            "lua_type": "number",
            "source": {
                "line": 29,
                "path": "../../res/data/script/lib/system/scene3d_vec2.lua"
            }
        },
        {
            "name": "y",
            "desc": "Get/Set the y component of the vector",
            "lua_type": "number",
            "source": {
                "line": 36,
                "path": "../../res/data/script/lib/system/scene3d_vec2.lua"
            }
        }
    ],
    "types": [],
    "name": "Vec2",
    "desc": "Generic vector class",
    "source": {
        "line": 5,
        "path": "../../res/data/script/lib/system/scene3d_vec2.lua"
    }
}