mirror of
https://git.do.srb2.org/STJr/SRB2.git
synced 2024-11-15 09:11:48 +00:00
Warn if Lua attempted access NOLUA consvar
And quote variable name.
This commit is contained in:
parent
18cbc1e370
commit
14c5d2c916
2 changed files with 5 additions and 2 deletions
|
@ -2364,7 +2364,10 @@ static boolean CV_Command(void)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (( com_flags & COM_SAFE ) && ( v->flags & CV_NOLUA ))
|
if (( com_flags & COM_SAFE ) && ( v->flags & CV_NOLUA ))
|
||||||
return false;
|
{
|
||||||
|
CONS_Alert(CONS_WARNING, "Variable '%s' cannot be changed from Lua.\n", v->name);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
// perform a variable print or set
|
// perform a variable print or set
|
||||||
if (COM_Argc() == 1)
|
if (COM_Argc() == 1)
|
||||||
|
|
|
@ -433,7 +433,7 @@ static int CVarSetFunction
|
||||||
consvar_t *cvar = *(consvar_t **)luaL_checkudata(L, 1, META_CVAR);
|
consvar_t *cvar = *(consvar_t **)luaL_checkudata(L, 1, META_CVAR);
|
||||||
|
|
||||||
if (cvar->flags & CV_NOLUA)
|
if (cvar->flags & CV_NOLUA)
|
||||||
return luaL_error(L, "Variable %s cannot be set from Lua.", cvar->name);
|
return luaL_error(L, "Variable '%s' cannot be set from Lua.", cvar->name);
|
||||||
|
|
||||||
switch (lua_type(L, 2))
|
switch (lua_type(L, 2))
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue