pub unsafe extern "C" fn mrb_funcall_argv(
mrb: *mut mrb_state,
val: mrb_value,
name: mrb_sym,
argc: mrb_int,
argv: *const mrb_value,
) -> mrb_valueExpand description
Call existing ruby functions. This is basically the type safe version of mrb_funcall.
#include <stdio.h>
#include <mruby.h>
#include "mruby/compile.h"
int
main()
{
mrb_state *mrb = mrb_open();
mrb_value obj = mrb_fixnum_value(1);
if (!mrb) { }
FILE *fp = fopen("test.rb","r");
mrb_value obj = mrb_load_file(mrb,fp);
mrb_funcall_argv(mrb, obj, MRB_SYM(method_name), 1, &obj); // Calling ruby function from test.rb.
fclose(fp);
mrb_close(mrb);
}@param mrb The current mruby state. @param val A reference to an mruby value. @param name_sym The symbol representing the method. @param argc The number of arguments the method has. @param obj Pointer to the object. @return mrb_value mrb_value mruby function value. @see mrb_funcall