LuaJIT: Add .name metafields for compatibility;

This commit is contained in:
bjorn 2019-02-07 15:46:10 -08:00 committed by Bjorn Swenson
parent 4a25a0120f
commit 3c83b36845
3 changed files with 755 additions and 748 deletions

View File

@ -63,7 +63,7 @@ float* luax_checkmathtype(lua_State* L, int index, MathType type, const char* ex
float* luax_newmathtype(lua_State* L, MathType type) {
MathType* x = (MathType*) lua_newuserdata(L, sizeof(MathType) + lovrMathTypeComponents[type] * sizeof(float));
luaL_getmetatable(L, "vec3");
luaL_getmetatable(L, lovrMathTypeNames[type]);
lua_setmetatable(L, -2);
*x = type;
return (float*) (x + 1);

View File

@ -79,6 +79,7 @@ local checkmat4 = checktype(mat4_t, 'mat4')
local vec3 = {
_type = C.MATH_VEC3,
name = 'vec3',
unpack = function(v)
checkvec3(v)
@ -238,6 +239,7 @@ math.vec3 = setmetatable(vec3, {
local quat = {
_type = C.MATH_QUAT,
name = 'quat',
unpack = function(q, raw)
checkquat(q)
@ -336,6 +338,7 @@ math.quat = setmetatable(quat, {
local mat4 = {
_type = C.MATH_MAT4,
name = 'mat4',
unpack = function(m, raw)
checkmat4(m)

File diff suppressed because it is too large Load Diff