// Class returns the class with the given name and superclass. Note that // if you call this with a class that doesn't exist, mruby will abort the // application (like a panic, but not a Go panic). // // super can be nil, in which case the Object class will be used. func (m *Mrb) Class(name string, super *Class) *Class { var class *C.struct_RClass if super == nil { class = C.mrb_class_get(m.state, C.CString(name)) } else { class = C.mrb_class_get_under(m.state, super.class, C.CString(name)) } return newClass(m, class) }
// Class returns the class with the given name and superclass. Note that // if you call this with a class that doesn't exist, mruby will abort the // application (like a panic, but not a Go panic). // // super can be nil, in which case the Object class will be used. func (m *Mrb) Class(name string, super *Class) *Class { cs := C.CString(name) defer C.free(unsafe.Pointer(cs)) var class *C.struct_RClass if super == nil { class = C.mrb_class_get(m.state, cs) } else { class = C.mrb_class_get_under(m.state, super.class, cs) } return newClass(m, class) }