luau icon indicating copy to clipboard operation
luau copied to clipboard

`vectors` may be incorrectly passed to functions that accept `{ x: number, y: number, z: number }`

Open deviaze opened this issue 2 months ago • 0 comments

Looks like somewhere vectors might be treated as { x: number, y: number, z: number } instead of as a readonly version of that shape?

This means this code doesn't throw any TypeErrors although it blows up at runtime:

--!strict

type vec3 = {
    x: number,
    y: number,
    z: number
}

local function increment(v: vec3)
    v.x += 1
    v.y += 1
    v.z += 1
    return v
end

local v2 = increment(vector.create(1, 2, 3))

deviaze avatar Oct 27 '25 22:10 deviaze