Skip to content

Conversation

@FjamZoo
Copy link

@FjamZoo FjamZoo commented Dec 21, 2025

Currently when doing typescript its quite annoying having to unpack an vector like

  offset: { x: OFFSET_COORDS.x, y: OFFSET_COORDS.y, z: OFFSET_COORDS.z },

Where with this I can just do

offset: OFFSET_COORDS.toArray(),

Not only more practicle but also a whole lot easier to read.

Note that this code is actually untested, so just be weary/do quick tests before merging.

Also sidenote for adding coords here

    if coordsType == "table" then
        if table.type(coords) == 'array' and type(coords[1]) ~= 'vector3' and #coords == 3 then
            coords = { vector3(coords[1], coords[2], coords[3]) }
        elseif coords.x and coords.y and coords.z then
            coords = { vector3(coords.x, coords.y, coords.z) }
        end
    end

It might be nice to also support arrays of {x=x, y=y, z=z} tables and arrays of number arrays at a later stage for better typescript support.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant