mirror of https://github.com/bjornbytes/lovr.git
LuaJIT: Add .name metafields for compatibility;
This commit is contained in:
parent
4a25a0120f
commit
3c83b36845
|
@ -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);
|
||||
|
|
|
@ -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)
|
||||
|
|
1498
src/api/math.lua.h
1498
src/api/math.lua.h
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue