From 937958afefef54b6dab2a618faa60945fa8a6126 Mon Sep 17 00:00:00 2001 From: helixhorned Date: Sun, 20 Oct 2013 12:35:03 +0000 Subject: [PATCH] LunaCON: add necessary identifier-is-not-gamevar check. git-svn-id: https://svn.eduke32.com/eduke32@4111 1a8010ca-5511-0410-912e-c29ae57300e0 --- polymer/eduke32/source/lunatic/lunacon.lua | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/polymer/eduke32/source/lunatic/lunacon.lua b/polymer/eduke32/source/lunatic/lunacon.lua index 88e6971b0..1928332bc 100644 --- a/polymer/eduke32/source/lunatic/lunacon.lua +++ b/polymer/eduke32/source/lunatic/lunacon.lua @@ -1494,13 +1494,17 @@ local function thisactor_to_pli(var) return (var=="_aci") and "_pli" or var end +function lookup.error_not_gamevar(identifier) + errprintf("symbol `%s' is not a game variable", identifier) + return "_INVALIDGV" +end + -- : code for actor or player index function lookup.gamevar(identifier, aorpvar, writable) local gv = g_gamevar[identifier] if (gv == nil) then - errprintf("symbol `%s' is not a game variable", identifier) - return "_INVALIDGV" + return lookup.error_not_gamevar(identifier) end if (writable and bit.band(gv.flags, GVFLAG.READONLY) ~= 0) then @@ -2099,6 +2103,9 @@ local handle = end 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 -- player index gets saved / loaded.