Also, when I do the translation, I don't want to use functions like rb_ary_new2 or rb_hash_new, since these two functions both return VALUE objects, not std::vector or std::map objects. I know there is no direct function in ruby.h to do the translation. I'm wondering if this is a certain process of function calls in ruby.h to do this. Thanks! Edward Liu wrote: > I already know how to check if 'object' is an array or a hash. I am > looking for how to translate 'object' from a Ruby array to a C/C++ > vector or from a Ruby hash to a C/C++ map. > > Jason Roelofs wrote: >> On Jan 11, 2008 2:12 PM, Edward Liu <liu_edward / emc.com> wrote: >> >>> is a macro called NUM2INT that converts a Ruby number into a C/C++ >>> Posted via http://www.ruby-forum.com/. >>> >>> >> You'll want something like: >> >> VALUE read_values(VALUE self, VALUE object) { >> if(rb_obj_is_instance_of(object, "Hash") { >> >> } else if (rb_obj_is_instance_of(object, "Array") { >> >> } >> } >> >> API is best found here: http://www.rubycentral.com/pickaxe/ext_ruby.html >> >> Jason -- Posted via http://www.ruby-forum.com/.