Mruby problem with requirement and require_relative

I am trying to use mRuby. I have compiled the mRuby source locally. I've tried this simple example:

inc.rb

def test(a, b)
    print "Inside the include->test(..)"
    return a+b
end

      

test1.rb

require_relative 'inc.rb'

def helloworld(var1)
    print 'hello world ' + var1 + ". Test number = " + test(4, 5)

end

helloworld('test')

      

test2.rb

require 'inc.rb'

def helloworld(var1)
    print 'hello world ' + var1 + ". Test number = " + test(4, 5)

end

helloworld('test')

      

I ran both test programs using mruby. mruby.exe test1.rb mruby.exe test2.rb

In both cases, I get the error:

"undefined method 'require_relative' for main (NoMethodError)"

"undefined method 'require' for main (NoMethodError)"

      

Does mRuby not support 'require'?

+1


source to share


1 answer


mruby requires no functionality. But you can use mruby-require mgem. https://github.com/mattn/mruby-require If you create mruby with mruby-require then you can use require. require_relative is not supported.



+1


source







All Articles