summaryrefslogtreecommitdiffhomepage
path: root/include/mruby.h
diff options
context:
space:
mode:
authordearblue <[email protected]>2021-06-19 15:08:09 +0900
committerYukihiro "Matz" Matsumoto <[email protected]>2021-06-19 21:15:02 +0900
commitc40802865a756f97ec8ffbd2361864b1fa291d4e (patch)
tree48dd585ab8eeb33124042b3be52bd4493600332c /include/mruby.h
parent43eddfd4d52a1c21fb248b979fbcc7321fabe73b (diff)
downloadmruby-c40802865a756f97ec8ffbd2361864b1fa291d4e.tar.gz
mruby-c40802865a756f97ec8ffbd2361864b1fa291d4e.zip
Added `MRB_API` function to get block arguments info.
- ` mrb_block_given_p()` -- The name comes from CRuby's `rb_block_given_p ()` At the same time, it applies to `f_instance_eval()` and `f_class_eval()` of `mruby-eval`.
Diffstat (limited to 'include/mruby.h')
-rw-r--r--include/mruby.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/include/mruby.h b/include/mruby.h
index 04d8c1a53..02be8300f 100644
--- a/include/mruby.h
+++ b/include/mruby.h
@@ -1004,6 +1004,11 @@ MRB_API const mrb_value *mrb_get_argv(mrb_state *mrb);
*/
MRB_API mrb_value mrb_get_arg1(mrb_state *mrb);
+/**
+ * Check if a block argument is given from mrb_state.
+ */
+MRB_API mrb_bool mrb_block_given_p(mrb_state *mrb);
+
/* `strlen` for character string literals (use with caution or `strlen` instead)
Adjacent string literals are concatenated in C/C++ in translation phase 6.
If `lit` is not one, the compiler will report a syntax error: