Log In  


Like the title says, the return value of :matmul, when passed true to indicate that the result should be stored in itself, is that same boolean value. This is inconvenient since it breaks method chaining. Here's a small repro as proof:

-- declare vector & metadata
local v = vec(1, 2, 3)
local m = userdata("f64", 3, 3)
m:set(0, 0,
	1, 0, 0,
	0, 1, 0,
	0, 0, 1
)

-- ok, should return userdata
? "return type 1: "..type(v:matmul(m))

-- ok, stores result in copy
local vcopy = v:copy()
? "return type 2: "..type(vcopy:matmul(m, vcopy))

-- prints boolean, breaks chaining
local vcopy = v:copy()
? "return type 3: "..type(vcopy:matmul(m, true))



[Please log in to post a comment]