Skip to content

elct9620/mruby-go

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

mruby-go

Go Reference Test Maintainability codecov

The pure go mruby virtual machine implementation.

Roadmap

The priority task is to make the virtual machine available with limited functions, it still depends on mrbc command to compile RiteBinary.

  • complete the method support
  • complete the class support
  • add mruby capability test

MRB_API

Golang has public and private method design and we can attach method to a struct. Therefore all public method is attach to *mruby.State in mruby-go as preferred method.

func (mrb *State) ObjectInstanceVariableGet(obj RObject, name Symbol) Value {
  return obj.ivGet(name)
}

// Prefer
func (mrb *State) ClassName(class RClass) string {
	if class == nil {
		return ""
	}

	name := mrb.ObjectInstanceVariableGet(class, _classname(mrb)) // <- Prefer this
	if name == nil {
		return ""
	}

	return name.(string)
}

// Avoid
func (mrb *State) ClassName(class RClass) string {
	if class == nil {
		return ""
	}

	name := class.ivGet(_classname(mrb)) // <- Avoid this
	if name == nil {
		return ""
	}

	return name.(string)
}

About

The pure go mruby virtual machine implementation.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published