Header: mruby/variable.h
Overview
Functions to access mruby variables.
Function Summary collapse
-
mrb_value mrb_const_get(mrb_state*, mrb_value, mrb_sym)
-
void mrb_const_set(mrb_state*, mrb_value, mrb_sym, mrb_value)
-
mrb_bool mrb_const_defined(mrb_state*, mrb_value, mrb_sym)
-
void mrb_const_remove(mrb_state*, mrb_value, mrb_sym)
-
mrb_bool mrb_iv_name_sym_p(mrb_state *, mrb_sym)
-
void mrb_iv_name_sym_check(mrb_state *, mrb_sym)
-
mrb_value mrb_obj_iv_get(mrb_state *, struct RObject *, mrb_sym)
-
void mrb_obj_iv_set(mrb_state *, struct RObject *, mrb_sym, mrb_value)
-
mrb_bool mrb_obj_iv_defined(mrb_state *, struct RObject *, mrb_sym)
-
mrb_value mrb_iv_get(mrb_state *, mrb_value, mrb_sym)
-
void mrb_iv_set(mrb_state *, mrb_value, mrb_sym, mrb_value)
-
mrb_bool mrb_iv_defined(mrb_state*, mrb_value, mrb_sym)
-
mrb_value mrb_iv_remove(mrb_state *, mrb_value, mrb_sym)
-
void mrb_iv_copy(mrb_state *, mrb_value, mrb_value)
-
mrb_bool mrb_const_defined_at(mrb_state *, mrb_value, mrb_sym)
-
mrb_value mrb_gv_get(mrb_state *, mrb_sym)
Get a global variable.
-
void mrb_gv_set(mrb_state *, mrb_sym, mrb_value)
Set a global variable.
-
void mrb_gv_remove(mrb_state *, mrb_sym)
Remove a global variable.
-
mrb_value mrb_cv_get(mrb_state *, mrb_value, mrb_sym)
-
void mrb_mod_cv_set(mrb_state *, struct RClass *, mrb_sym, mrb_value)
-
void mrb_cv_set(mrb_state *, mrb_value, mrb_sym, mrb_value)
-
mrb_bool mrb_cv_defined(mrb_state *, mrb_value, mrb_sym)
-
void mrb_iv_foreach(mrb_state *, mrb_value, mrb_iv_foreach_func *, void *)
Define Summary
- #define MRUBY_VARIABLE_H
Function Details
mrb_value mrb_const_get(mrb_state* , mrb_value , mrb_sym )
void mrb_const_set(mrb_state* , mrb_value , mrb_sym , mrb_value )
mrb_bool mrb_const_defined(mrb_state* , mrb_value , mrb_sym )
void mrb_const_remove(mrb_state* , mrb_value , mrb_sym )
mrb_bool mrb_iv_name_sym_p(mrb_state * mrb, mrb_sym sym)
void mrb_iv_name_sym_check(mrb_state * mrb, mrb_sym sym)
mrb_value mrb_obj_iv_get(mrb_state * mrb, struct RObject * obj, mrb_sym sym)
void mrb_obj_iv_set(mrb_state * mrb, struct RObject * obj, mrb_sym sym, mrb_value v)
mrb_bool mrb_obj_iv_defined(mrb_state * mrb, struct RObject * obj, mrb_sym sym)
mrb_value mrb_iv_get(mrb_state * mrb, mrb_value obj, mrb_sym sym)
void mrb_iv_set(mrb_state * mrb, mrb_value obj, mrb_sym sym, mrb_value v)
mrb_bool mrb_iv_defined(mrb_state* , mrb_value , mrb_sym )
mrb_value mrb_iv_remove(mrb_state * mrb, mrb_value obj, mrb_sym sym)
void mrb_iv_copy(mrb_state * mrb, mrb_value dst, mrb_value src)
mrb_bool mrb_const_defined_at(mrb_state * mrb, mrb_value mod, mrb_sym id)
mrb_value mrb_gv_get(mrb_state * mrb, mrb_sym sym)
Get a global variable. Will return nil if the var does not exist
Example:
# Ruby style
var = $value
!!!c
// C style
mrb_sym sym = mrb_intern_lit(mrb, "$value");
mrb_value var = mrb_gv_get(mrb, sym);
void mrb_gv_set(mrb_state * mrb, mrb_sym sym, mrb_value val)
Set a global variable
Example:
# Ruby style
$value = "foo"
!!!c
// C style
mrb_sym sym = mrb_intern_lit(mrb, "$value");
mrb_gv_set(mrb, sym, mrb_str_new_lit("foo"));
void mrb_gv_remove(mrb_state * mrb, mrb_sym sym)
Remove a global variable.
Example:
# Ruby style
$value = nil
// C style
mrb_sym sym = mrb_intern_lit(mrb, "$value");
mrb_gv_remove(mrb, sym);