Add mobj.standingslope to Lua

This commit is contained in:
Monster Iestyn 2018-10-21 15:12:51 +01:00
parent 2ec4f2024f
commit efff869e6e

View file

@ -80,7 +80,12 @@ enum mobj_e {
mobj_extravalue1, mobj_extravalue1,
mobj_extravalue2, mobj_extravalue2,
mobj_cusval, mobj_cusval,
#ifdef ESLOPE
mobj_cvmem,
mobj_standingslope
#else
mobj_cvmem mobj_cvmem
#endif
}; };
static const char *const mobj_opt[] = { static const char *const mobj_opt[] = {
@ -140,6 +145,9 @@ static const char *const mobj_opt[] = {
"extravalue2", "extravalue2",
"cusval", "cusval",
"cvmem", "cvmem",
#ifdef ESLOPE
"standingslope",
#endif
NULL}; NULL};
#define UNIMPLEMENTED luaL_error(L, LUA_QL("mobj_t") " field " LUA_QS " is not implemented for Lua and cannot be accessed.", mobj_opt[field]) #define UNIMPLEMENTED luaL_error(L, LUA_QL("mobj_t") " field " LUA_QS " is not implemented for Lua and cannot be accessed.", mobj_opt[field])
@ -343,6 +351,11 @@ static int mobj_get(lua_State *L)
case mobj_cvmem: case mobj_cvmem:
lua_pushinteger(L, mo->cvmem); lua_pushinteger(L, mo->cvmem);
break; break;
#ifdef ESLOPE
case mobj_standingslope:
LUA_PushUserdata(L, mo->standingslope, META_SLOPE);
break;
#endif
default: // extra custom variables in Lua memory default: // extra custom variables in Lua memory
lua_getfield(L, LUA_REGISTRYINDEX, LREG_EXTVARS); lua_getfield(L, LUA_REGISTRYINDEX, LREG_EXTVARS);
I_Assert(lua_istable(L, -1)); I_Assert(lua_istable(L, -1));
@ -634,6 +647,10 @@ static int mobj_set(lua_State *L)
case mobj_cvmem: case mobj_cvmem:
mo->cvmem = luaL_checkinteger(L, 3); mo->cvmem = luaL_checkinteger(L, 3);
break; break;
#ifdef ESLOPE
case mobj_standingslope:
return NOSET;
#endif
default: default:
lua_getfield(L, LUA_REGISTRYINDEX, LREG_EXTVARS); lua_getfield(L, LUA_REGISTRYINDEX, LREG_EXTVARS);
I_Assert(lua_istable(L, -1)); I_Assert(lua_istable(L, -1));