diff options
| author | Yukihiro "Matz" Matsumoto <[email protected]> | 2020-04-22 16:44:39 +0900 |
|---|---|---|
| committer | Yukihiro "Matz" Matsumoto <[email protected]> | 2020-04-22 16:44:39 +0900 |
| commit | 87d1bbe94794304d92fc9a4af5cf17eab5d1534c (patch) | |
| tree | 820e8b289e58db55ea4a3b298d2af4e7a8fba0bc /include/mruby.h | |
| parent | 2e661e82d16cc1d68cf9415b3d4c872fdd798745 (diff) | |
| download | mruby-87d1bbe94794304d92fc9a4af5cf17eab5d1534c.tar.gz mruby-87d1bbe94794304d92fc9a4af5cf17eab5d1534c.zip | |
Add new function `mrb_singleton_class_ptr()`; ref #4973
The difference between `mrb_singleton_class` and `mrb_singleton_class_ptr`:
- `mrb_singleton_class_ptr` returns `struct RClass*`.
- `mrb_singleton_class_ptr` returns `NULL` on immediate values where
`mrb_singleton_class` raises exceptions.
Diffstat (limited to 'include/mruby.h')
| -rw-r--r-- | include/mruby.h | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/include/mruby.h b/include/mruby.h index 7419618fd..4b7a673f3 100644 --- a/include/mruby.h +++ b/include/mruby.h @@ -317,7 +317,9 @@ MRB_API struct RClass *mrb_define_class(mrb_state *mrb, const char *name, struct * @return [struct RClass *] Reference to the newly defined module. */ MRB_API struct RClass *mrb_define_module(mrb_state *mrb, const char *name); + MRB_API mrb_value mrb_singleton_class(mrb_state *mrb, mrb_value val); +MRB_API struct RClass *mrb_singleton_class_ptr(mrb_state *mrb, mrb_value val); /** * Include a module in another class or module. |
