https://github.com/elct9620/mruby-go
The pure go mruby virtual machine implementation.
https://github.com/elct9620/mruby-go
golang mruby
Last synced: 7 months ago
JSON representation
The pure go mruby virtual machine implementation.
- Host: GitHub
- URL: https://github.com/elct9620/mruby-go
- Owner: elct9620
- License: mit
- Created: 2023-06-15T14:33:41.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2024-04-11T13:12:37.000Z (almost 2 years ago)
- Last Synced: 2024-04-14T02:25:34.067Z (almost 2 years ago)
- Topics: golang, mruby
- Language: Go
- Homepage:
- Size: 186 KB
- Stars: 11
- Watchers: 2
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
mruby-go
===
[](https://pkg.go.dev/github.com/elct9620/mruby-go)
[](https://github.com/elct9620/mruby-go/actions/workflows/test.yml)
[](https://codeclimate.com/github/elct9620/mruby-go/maintainability)
[](https://codecov.io/gh/elct9620/mruby-go)
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.
```go
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)
}
```