Why do I get different outputs is I use :unpack()
directly, as opposed to putting it into variables?
It looks like 0
values are returned as nil
.
local a = geo.vector2D.new(0, 1)
local b = geo.vector2D.new(1, 0)
local c = geo.vector2D.new(1, 1)
print('Packed', 'a', a, 'b', b, 'c', c)
print('Unpacked', 'a', a:unpack(), 'b', b:unpack(), 'c', c:unpack())
local ax, ay = a:unpack()
local bx, by = b:unpack()
local cx, cy = c:unpack()
print('Via variables a', ax, ay)
print('Via variables b', bx, by)
print('Via variables c', cx, cy)
Packed a (0.0, 1.0) b (1.0, 0.0) c (1.0, 1.0)
Unpacked a 0.0 b 1.0 c 1.0 1.0
Via variables a 0.0 1.0
Via variables b 1.0 0.0
Via variables c 1.0 1.0