Skip to content
This repository

go-mruby make interface to embed mruby into go.

branch: master

Merge pull request #7 from raggi/master

Update to current mruby head
latest commit ac4a7d33f3
mattn authored December 30, 2013
Octocat-spinner-32 example add example using map. May 11, 2012
Octocat-spinner-32 mruby @ 14bff24 Update to current mruby head December 28, 2013
Octocat-spinner-32 .gitmodules first import. May 10, 2012
Octocat-spinner-32 Makefile Use static library July 20, 2013
Octocat-spinner-32 Makefile.w32 add ARGV. May 10, 2012
Octocat-spinner-32 README.mkd fix doc. May 10, 2012
Octocat-spinner-32 mruby.def update. May 18, 2012
Octocat-spinner-32 mruby.go Update to current mruby head December 28, 2013
Octocat-spinner-32 mruby_test.go
README.mkd

go-mruby

go-mruby make interface to embed mruby into go.

Install

git submodule init
git submodule update
make
cd example
go build -x .
LD_LIBRARY_PATH=.. ./example

On windows, use Makefile.w32

mingw32-make -f Makefile.w32
copy mruby.dll example
cd example
go build -x .
example.exe

Usage

package main

import "github.com/mattn/go-mruby"

func main() {
    mrb := mruby.New()
    defer mrb.Close()

    println(mrb.Eval(`"hello " + ARGV[0]`, "mruby").(string))

    for _, i := range mrb.Eval(`ARGV.map {|x| x + 1}`, 1, 2, 3).([]interface{}) {
        println(i.(int32)) // 2 3 4
    }
}

License

MIT

Author

  • Yasuhiro Matsumoto
Something went wrong with that request. Please try again.