pub unsafe extern "C" fn mrb_define_module_function(
mrb: *mut mrb_state,
cla: *mut RClass,
name: *const c_char,
fun: mrb_func_t,
aspec: mrb_aspec,
)
Expand description
Defines a module function.
Example:
module Foo
def Foo.bar
end
end
// C style
mrb_value bar_method(mrb_state* mrb, mrb_value self){
return mrb_nil_value();
}
void mrb_example_gem_init(mrb_state* mrb){
struct RClass *foo;
foo = mrb_define_module(mrb, "Foo");
mrb_define_module_function(mrb, foo, "bar", bar_method, MRB_ARGS_NONE());
}
@param mrb The MRuby state reference. @param cla The module where the module function will be defined. @param name The name of the module function being defined. @param fun The function pointer to the module function definition. @param aspec The method parameters declaration.