Skip to content
Use extend Lua using Ruby with MRuby
C Ruby Lua
Latest commit 47ea62a Dec 24, 2012 @RyanScottLewis Update
Failed to load latest commit information.
lib 0.1-0 release Dec 24, 2012
spec 0.1-0 release Dec 24, 2012
.gitmodules add Lua and MRuby submodules Dec 20, 2012
Makefile Makefile that simply calls Rakefile Dec 20, 2012 Update Dec 24, 2012
Rakefile Use Rake instead of Make Dec 19, 2012
mruby-0.1-0.rockspec 0.1-0 release Dec 24, 2012


Use mruby from within lua.



NOTE: This is not implemented yet.

$ luarocks install mruby


NOTE: If rake is not installed, you can use the minirake executable in lib/mruby/minirake/.
The Makefile simply calls rake.

$ rake


$ make

This will compile a file in the pkg directory which you can simply require within Lua.


MRuby Table

The mruby table contains a few helper functions just for evaluating and running MRuby code.


The run function simply runs MRuby code. It returns a 0 if it ran without any exceptions raised and 1 if an exception was raised." puts 'Hello, World!' ") -- prints "Hello, World!"


The eval function will evaluate MRuby code. The return value will converted into a Lua object.

  mruby.eval(" 'Hello,' ").." World!"
) -- prints "Hello, World!"

  mruby.eval(" 50 + 50 ") + 100
) -- prints 200

C Functions/Types

NOTE: This has not been implemented yet.

All MRuby C functions/types have been ported directly to Lua.
The name of the functions/types are identical to those of the C functions/types.

mrb_interpreter = mrb_open()
mrb_code = " puts 'Hello, World!' "
mrb_parser_state = mrb_parse_string(mrb_interpreter, mrb_code, nil)
mrb_generated_code = mrb_generate_code(mrb_interpreter, mrb_parser_state.tree)
mrb_result = mrb_run( mrb_interpreter, mrb_proc_new(mrb_interpreter, mrb_interpreter.irep[mrb_generated_code]), mrb_nil_value() )


matsumoto-r for mruby-on-Lua. This wouldn't exist, if not for him.


Copyright © 2012-2013 Ryan Scott Lewis

The MIT License (MIT) - See LICENSE for further details.

Something went wrong with that request. Please try again.