コード例 #1
0
 public void While(dynamic cond, AxFunction Do)
 {
     if (cond is AxVariablePtr)
     {
         while (Variables[cond])
         {
             Do.Call(this, null);
         }
     }
     else if (cond is Boolean)
     {
         throw new AxException(this, "Using a Boolean directly will mean it wont get updated, you need to use a variable pointer.");
     }
     else if (cond is AxFunction)
     {
         while ((bool) cond.Call(this, null))
         {
             Do.Call(this, null);
         }
     }
 }
コード例 #2
0
ファイル: Main.cs プロジェクト: elliotharris/AxScript
 public static void InitExitHandler(AxInterpreter ax, AxFunction func)
 {
     ax.ScriptError += exception => func.Call<Boolean>(ax, new object[] {EXIT_CODE_ERROR, exception});
     ax.ScriptEnd += exception => func.Call<Boolean>(ax, new object[] { EXIT_CODE_CLEAN, exception });
 }
コード例 #3
0
 public bool Not(AxFunction input)
 {
     return !(bool) input.Call(this, null);
 }
コード例 #4
0
 public void IfElse(bool cond, AxFunction then, AxFunction elseF)
 {
     if (cond)
     {
         then.Call(this, null);
     }
     else
     {
         elseF.Call(this, null);
     }
 }
コード例 #5
0
 public void If(bool cond, AxFunction then)
 {
     if (cond)
     {
         then.Call(this, null);
     }
 }
コード例 #6
0
 public void For(object range, AxFunction func)
 {
     var r = (IEnumerable) range;
     foreach (var b in from object v in r select func.ParamCount == 1 ? new Dictionary<string, object> {{func.Parameters[0], v}} : new Dictionary<string, object>())
     {
         func.Call(this, b);
     }
 }
コード例 #7
0
 public void Do(AxFunction Do, AxFunction cond)
 {
     do
     {
         Do.Call(this, null);
     } while ((bool) cond.Call(this, null));
 }