mirror of
https://git.do.srb2.org/STJr/SRB2.git
synced 2025-03-23 11:21:01 +00:00
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:
commit
dfeddafc03
1 changed files with 8 additions and 0 deletions
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue