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); } } }
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 }); }
public bool Not(AxFunction input) { return !(bool) input.Call(this, null); }
public void IfElse(bool cond, AxFunction then, AxFunction elseF) { if (cond) { then.Call(this, null); } else { elseF.Call(this, null); } }
public void If(bool cond, AxFunction then) { if (cond) { then.Call(this, null); } }
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); } }
public void Do(AxFunction Do, AxFunction cond) { do { Do.Call(this, null); } while ((bool) cond.Call(this, null)); }