/// <summary> /// Builds the return value of a call /// </summary> /// <param name="outParams">The out parameters indices, or null. See <see cref="BuildArgumentList" />.</param> /// <param name="pars">The parameters passed to the function.</param> /// <param name="retv">The return value from the function. Use DynValue.Void if the function returned no value.</param> /// <returns>A DynValue to be returned to scripts</returns> protected static R_VAL BuildReturnValue(RubyState state, List <int> outParams, object[] pars, object retv) { if (outParams == null) { return(RubyState.ObjectToValue(state, retv)); } else { R_VAL[] rets = new R_VAL[outParams.Count + 1]; if (retv is R_VAL && R_VAL.IsNil(( R_VAL )retv)) { rets[0] = R_VAL.NIL; } else { rets[0] = RubyState.ObjectToValue(state, retv); } for (int i = 0; i < outParams.Count; i++) { rets[i + 1] = RubyState.ObjectToValue(state, pars[outParams[i]]); } R_VAL ary = RubyDLL.r_ary_new(); foreach (var p in rets) { RubyDLL.r_ary_push(state, ary, p); } return(ary); } }
/// <summary> /// Builds the return value of a call /// </summary> /// <param name="outParams">The out parameters indices, or null. See <see cref="BuildArgumentList" />.</param> /// <param name="pars">The parameters passed to the function.</param> /// <param name="retv">The return value from the function. Use DynValue.Void if the function returned no value.</param> /// <returns>A DynValue to be returned to scripts</returns> protected static R_VAL BuildReturnValue(RubyState state, object retv) { return(RubyState.ObjectToValue(state, retv)); }
/// <summary> /// The internal callback which actually executes the method /// </summary> /// <param name="obj">The object.</param> /// <param name="args">The arguments.</param> /// <returns></returns> public R_VAL ExecuteGet(RubyState state, object obj, CallbackArguments args) { return(RubyState.ObjectToValue(state, FieldInfo.GetValue(obj))); }
/// <summary> /// The internal callback which actually executes the method /// </summary> /// <param name="script">The script.</param> /// <param name="obj">The object.</param> /// <param name="context">The context.</param> /// <param name="args">The arguments.</param> /// <returns></returns> public R_VAL ExecuteGet(RubyState state, object obj, CallbackArguments args) { return(RubyState.ObjectToValue(state, PropertyInfo.GetValue(obj, null))); }