pub unsafe extern "C" fn mrb_define_const(
mrb: *mut mrb_state,
cla: *mut RClass,
name: *const c_char,
val: mrb_value,
)
Expand description
Defines a constant.
Example:
class ExampleClass
AGE = 22
end
// C style
#include <stdio.h>
#include <mruby.h>
void
mrb_example_gem_init(mrb_state* mrb){
mrb_define_const(mrb, mrb->kernel_module, "AGE", mrb_fixnum_value(22));
}
mrb_value
mrb_example_gem_final(mrb_state* mrb){
}
@param mrb The MRuby state reference. @param cla A class or module the constant is defined in. @param name The name of the constant being defined. @param val The value for the constant.