mruby/mruby — pull request #1985 by take-cheeze (2014-03-31 01:16:56+00:00)
Title: Add API to define cfunc Proc with userdata.

The APIs are defined in mruby-proc-ext so include it before using this API.
This should resolve #1794 .

`mrb_proc_new_cfunc_with_env` creates cfunc Proc with *env*(=userdata).
To define a method with it use `mrb_define_method_raw` instead of function like `mrb_define_method`.

`mrb_cfunc_env_get(mrb_state*, mrb_int)` retrieves env variable associated to current cfunc Proc.
It may raise `TypeError` if the current Proc isn't cfunc Proc or it doesn't have *env* associated.
And it may raise `IndexError` if 2nd argument is out of range of *env*.

(Please read test code added for more detail usage.)