Header: mruby/array.h

Overview

Array class

Included heaers

Function Summary collapse

Define Summary

#define MRUBY_ARRAY_H
#define mrb_ary_ptr
#define mrb_ary_value
#define RARRAY
#define RARRAY_LEN
#define RARRAY_PTR
#define MRB_ARY_SHARED
#define ARY_SHARED_P
#define ARY_SET_SHARED_FLAG
#define ARY_UNSET_SHARED_FLAG

Function Details

void mrb_ary_modify(mrb_state* , struct RArray* )

mrb_value mrb_ary_new_capa(mrb_state* , mrb_int )

mrb_value mrb_ary_new(mrb_state * mrb)

Initializes a new array.

Equivalent to:

Array.new

Parameters:

  • mrb

    The MRuby state reference.

Returns:

  • The initialized array

mrb_value mrb_ary_new_from_values(mrb_state * mrb, mrb_int size, const mrb_value * vals)

mrb_value mrb_assoc_new(mrb_state * mrb, mrb_value car, mrb_value cdr)

void mrb_ary_concat(mrb_state* , mrb_value , mrb_value )

mrb_value mrb_ary_splat(mrb_state* , mrb_value )

void mrb_ary_push(mrb_state * mrb, mrb_value array, mrb_value value)

Pushes value into array.

Equivalent to:

ary << value

Parameters:

  • mrb

    The MRuby state reference.

  • ary

    The array in which the value will be pushed

  • value

    The value to be pushed into array

mrb_value mrb_ary_pop(mrb_state * mrb, mrb_value ary)

Pops the last element from the array.

Equivalent to:

ary.pop

Parameters:

  • mrb

    The MRuby state reference.

  • ary

    The array from which the value will be poped.

Returns:

  • The poped value.

mrb_value mrb_ary_ref(mrb_state * mrb, mrb_value ary, mrb_int n)

Returns a reference to an element of the array on the given index.

Equivalent to:

ary[n]

Parameters:

  • mrb

    The MRuby state reference.

  • ary

    The target array.

  • n

    The array index being referenced

Returns:

  • The referenced value.

void mrb_ary_set(mrb_state * mrb, mrb_value ary, mrb_int n, mrb_value val)

Sets a value on an array at the given index

Equivalent to:

ary[n] = val

Parameters:

  • mrb

    The MRuby state reference.

  • ary

    The target array.

  • n

    The array index being referenced.

  • val

    The value being setted.

void mrb_ary_replace(mrb_state * mrb, mrb_value a, mrb_value b)

mrb_value mrb_check_array_type(mrb_state * mrb, mrb_value self)

mrb_value mrb_ary_unshift(mrb_state * mrb, mrb_value self, mrb_value item)

mrb_value mrb_ary_entry(mrb_value ary, mrb_int offset)

mrb_value mrb_ary_shift(mrb_state * mrb, mrb_value self)

mrb_value mrb_ary_clear(mrb_state * mrb, mrb_value self)

mrb_value mrb_ary_join(mrb_state * mrb, mrb_value ary, mrb_value sep)

mrb_value mrb_ary_resize(mrb_state * mrb, mrb_value ary, mrb_int len)