mirror of
https://github.com/mruby/mruby
synced 2026-06-08 16:11:16 +00:00
mrb_p() should print mrb_obj_as_string() if #inspect does not return a string value
This commit is contained in:
+7
-2
@@ -27,8 +27,13 @@ MRB_API void
|
||||
mrb_p(mrb_state *mrb, mrb_value obj)
|
||||
{
|
||||
#ifdef ENABLE_STDIO
|
||||
obj = mrb_funcall(mrb, obj, "inspect", 0);
|
||||
printstr(mrb, obj);
|
||||
mrb_value val;
|
||||
|
||||
val = mrb_funcall(mrb, obj, "inspect", 0);
|
||||
if (!mrb_string_p(val)) {
|
||||
val = mrb_obj_as_string(mrb, obj);
|
||||
}
|
||||
printstr(mrb, val);
|
||||
putc('\n', stdout);
|
||||
#endif
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user