LunaCON: add necessary identifier-is-not-gamevar check.

git-svn-id: https://svn.eduke32.com/eduke32@4111 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
helixhorned 2013-10-20 12:35:03 +00:00
parent bee968a535
commit 937958afef
1 changed files with 9 additions and 2 deletions

View File

@ -1494,13 +1494,17 @@ local function thisactor_to_pli(var)
return (var=="_aci") and "_pli" or var return (var=="_aci") and "_pli" or var
end end
function lookup.error_not_gamevar(identifier)
errprintf("symbol `%s' is not a game variable", identifier)
return "_INVALIDGV"
end
-- <aorpvar>: code for actor or player index -- <aorpvar>: code for actor or player index
function lookup.gamevar(identifier, aorpvar, writable) function lookup.gamevar(identifier, aorpvar, writable)
local gv = g_gamevar[identifier] local gv = g_gamevar[identifier]
if (gv == nil) then if (gv == nil) then
errprintf("symbol `%s' is not a game variable", identifier) return lookup.error_not_gamevar(identifier)
return "_INVALIDGV"
end end
if (writable and bit.band(gv.flags, GVFLAG.READONLY) ~= 0) then if (writable and bit.band(gv.flags, GVFLAG.READONLY) ~= 0) then
@ -2099,6 +2103,9 @@ local handle =
end end
local gv = g_gamevar[identifier] local gv = g_gamevar[identifier]
if (gv == nil) then
return lookup.error_not_gamevar(identifier)
end
-- For per-actor or per-player gamevars, the value at the current actor or -- For per-actor or per-player gamevars, the value at the current actor or
-- player index gets saved / loaded. -- player index gets saved / loaded.