diff options
-rw-r--r-- | builtin/common/tests/vector_spec.lua | 1 | ||||
-rw-r--r-- | builtin/common/vector.lua | 2 |
2 files changed, 2 insertions, 1 deletions
diff --git a/builtin/common/tests/vector_spec.lua b/builtin/common/tests/vector_spec.lua index 2a50e2889..2f72f3383 100644 --- a/builtin/common/tests/vector_spec.lua +++ b/builtin/common/tests/vector_spec.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,)")}) diff --git a/builtin/common/vector.lua b/builtin/common/vector.lua index 02fc1bdee..581d014e0 100644 --- a/builtin/common/vector.lua +++ b/builtin/common/vector.lua @@ -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) |