Browse Source

Fix __INLINEIF declaration

Bepis 6 years ago
parent
commit
d44104de73

+ 4 - 0
NTERA.Engine/Runtime/Base/Functions.cs

@@ -49,6 +49,10 @@ namespace NTERA.Engine.Runtime.Base
 		public static Value InlineIf(EraRuntime runtime, StackFrame context, IList<Parameter> parameters)
 		public static Value InlineIf(EraRuntime runtime, StackFrame context, IList<Parameter> parameters)
 		{
 		{
 			// For syntax like \@THIRD_PERSON?Third Person#Second Person\@
 			// For syntax like \@THIRD_PERSON?Third Person#Second Person\@
+
+			if (parameters.Count != 3)
+				throw new EraRuntimeException("Invalid amount of parameters");
+
 			return parameters[0].Value
 			return parameters[0].Value
 				? parameters[1].Value
 				? parameters[1].Value
 				: parameters[2].Value;
 				: parameters[2].Value;

+ 2 - 1
NTERA.Engine/Runtime/BaseDefinitions.cs

@@ -209,7 +209,8 @@ namespace NTERA.Engine.Runtime
 			new FunctionDefinition("GETFONT", new FunctionParameter[0], new FunctionVariable[0], true, "__GLOBAL"),
 			new FunctionDefinition("GETFONT", new FunctionParameter[0], new FunctionVariable[0], true, "__GLOBAL"),
 			new FunctionDefinition("GETMILLISECOND", new FunctionParameter[0], new FunctionVariable[0], true, "__GLOBAL"),
 			new FunctionDefinition("GETMILLISECOND", new FunctionParameter[0], new FunctionVariable[0], true, "__GLOBAL"),
 
 
-			new FunctionDefinition("__FORMAT",  new[] { new FunctionParameter("a"), new FunctionParameter("a"), new FunctionParameter("a"), }, new FunctionVariable[0], true, "__GLOBAL")
+			new FunctionDefinition("__FORMAT",  new[] { new FunctionParameter("a"), new FunctionParameter("b"), new FunctionParameter("c"), }, new FunctionVariable[0], true, "__GLOBAL"),
+			new FunctionDefinition("__INLINEIF",  new[] { new FunctionParameter("condition"), new FunctionParameter("ifTrue"), new FunctionParameter("ifFalse"), }, new FunctionVariable[0], true, "__GLOBAL")
 		};
 		};
 
 
 		public static Keyword[] DefaultKeywords { get; } =
 		public static Keyword[] DefaultKeywords { get; } =