vec2 and matrix4 pure lua implementation