Merge branch 'nolua2' into 'next'

Don't let Lua set cvars that have CV_NOLUA

See merge request STJr/SRB2!1245
This commit is contained in:
James R 2020-11-14 18:37:21 -05:00
commit dfeddafc03
1 changed files with 8 additions and 0 deletions

View File

@ -440,6 +440,9 @@ static int CVarSetFunction
){
consvar_t *cvar = (consvar_t *)luaL_checkudata(L, 1, META_CVAR);
if (cvar->flags & CV_NOLUA)
return luaL_error(L, "Variable %s cannot be set from Lua.", cvar->name);
switch (lua_type(L, 2))
{
case LUA_TSTRING:
@ -468,7 +471,12 @@ static int lib_cvStealthSet(lua_State *L)
static int lib_cvAddValue(lua_State *L)
{
consvar_t *cvar = (consvar_t *)luaL_checkudata(L, 1, META_CVAR);
if (cvar->flags & CV_NOLUA)
return luaL_error(L, "Variable %s cannot be set from Lua.", cvar->name);
CV_AddValue(cvar, (INT32)luaL_checknumber(L, 2));
return 0;
}