@/lua/common/mathlib.lua
function vec3(x, y, z)
if rawequal(y, nil) then
if rawequal(x, nil) then
if rawequal(y, nil) then
if rawequal(x, nil) then
return newLuaVec3xyz(0, 0, 0)
else
if rawequal(x.xyz, nil) then
return newLuaVec3xyz(x.x or x[1], x.y or x[2], x.z or x[3])
function LuaVec3:set(x, y, z)
if rawequal(y, nil) then
self.x, self.y, self.z = x:xyz()
function LuaVec3.__eq(a, b)
return (not rawequal(b, nil)) and a.x == b.x and a.y == b.y and a.z == b.z
end
local s = stackv3[stacki]
if rawequal(y, nil) then
s.x, s.y, s.z = x:xyz()
function quat(x, y, z, w)
if rawequal(y, nil) then
if type(x) == 'table' and x[4] ~= nil then
return newLuaQuatxyzw(x[1], x[2], x[3], x[4])
elseif rawequal(x, nil) then
return newLuaQuatxyzw(1, 0, 0, 0)
function LuaQuat:set(x, y, z, w)
if rawequal(y, nil) then
self.x, self.y, self.z, self.w = x.x, x.y, x.z, x.w