Skip to content

Commit

Permalink
Fix vector.from_string returning a table without vector metatable
Browse files Browse the repository at this point in the history
  • Loading branch information
Desour authored and ShadowNinja committed Jan 3, 2022
1 parent 84fdd36 commit 1965628
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
1 change: 1 addition & 0 deletions builtin/common/tests/vector_spec.lua
Expand Up @@ -300,6 +300,7 @@ describe("vector", function()

it("from_string()", function()
local v = vector.new(1, 2, 3.14)
assert.is_true(vector.check(vector.from_string("(1, 2, 3.14)")))
assert.same({v, 13}, {vector.from_string("(1, 2, 3.14)")})
assert.same({v, 12}, {vector.from_string("(1,2 ,3.14)")})
assert.same({v, 12}, {vector.from_string("(1,2,3.14,)")})
Expand Down
2 changes: 1 addition & 1 deletion builtin/common/vector.lua
Expand Up @@ -61,7 +61,7 @@ function vector.from_string(s, init)
if not (x and y and z) then
return nil
end
return {x = x, y = y, z = z}, np
return fast_new(x, y, z), np
end

function vector.to_string(v)
Expand Down

0 comments on commit 1965628

Please sign in to comment.