diff --git a/src/scripting/backend/codegen.cpp b/src/scripting/backend/codegen.cpp index a8053badd0..0055c656bd 100644 --- a/src/scripting/backend/codegen.cpp +++ b/src/scripting/backend/codegen.cpp @@ -10632,11 +10632,17 @@ FxExpression *FxReturnStatement::Resolve(FCompileContext &ctx) if (ctx.ReturnProto != nullptr && ctx.ReturnProto->ReturnTypes.Size() != Args.Size()) { - ScriptPosition.Message(MSG_ERROR, "Incorrect number of return values. Got %u, but expected %u", Args.Size(), ctx.ReturnProto->ReturnTypes.Size()); - delete this; - return nullptr; + int severity = ctx.Version >= MakeVersion(3, 7) ? MSG_ERROR : MSG_WARNING; + ScriptPosition.Message(severity, "Incorrect number of return values. Got %u, but expected %u", Args.Size(), ctx.ReturnProto->ReturnTypes.Size()); + if (severity == MSG_ERROR) + { + delete this; + return nullptr; + } + // For older script versions this must fall through. } - else if (Args.Size() == 0) + + if (Args.Size() == 0) { TArray none(0); retproto = NewPrototype(none, none); diff --git a/wadsrc/static/zscript.txt b/wadsrc/static/zscript.txt index 082b69532d..449bfe054c 100644 --- a/wadsrc/static/zscript.txt +++ b/wadsrc/static/zscript.txt @@ -1,4 +1,4 @@ -version "3.4" +version "3.7" #include "zscript/base.txt" #include "zscript/sounddata.txt" #include "zscript/mapdata.txt"