Skip to content
Permalink
Browse files
Fix vector.from_string returning a table without vector metatable
  • Loading branch information
Desour authored and ShadowNinja committed Jan 3, 2022
1 parent 84fdd36 commit 196562870552b156265feb83043da2bc21bd6246
Showing with 2 additions and 1 deletion.
  1. +1 −0 builtin/common/tests/vector_spec.lua
  2. +1 −1 builtin/common/vector.lua
@@ -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,)")})
@@ -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)

0 comments on commit 1965628

Please sign in to comment.