rubyapi Reference

Impressum / Imprint

Files

File Download Size Description
rubyapi.lua test.mk16.de/scriptFiles/rubyapi.lua 1.0 KiloBytes(KB) Lua script
rubyapi-1.0-1.rockspec test.mk16.de/scriptFiles/rubyapi-1.0-1.rockspec 598 Bytes(B) Lua Rock Specification
rubyapi-1.0-1.src.rock test.mk16.de/scriptFiles/rubyapi-1.0-1.src.rock 950 Bytes(B) Lua rock

Classes

Class Description Methods
rubyapi Interface between the program and Ruby new, version, interpret, close

Class LuaApi Methods

Method Argument 1 Argument 2 Return Description
new None None The class Create a new interface
version None None The Ruby version of the Ruby interpreter Returns the Ruby version of the Ruby interpreter.
interpret The Ruby code to be interpreted. How to handle errors: true: If an error occurs, an error message will be displayed and the execution of the Lua script will be aborted. false: If an error occurs, no error message is output, the interpret method completes the interpretation and returns nil. The result of the interpretation. Interpret Ruby code
close None None None Closes the interface, even temporary files of the interface are deleted.

rubyapi is an API that can be used to execute Ruby code from a Lua program.
This requires Ruby to be installed on the computer.

If you see the message "Could not run Ruby. Please check if you have Ruby installed."
even though you have Ruby installed and you can call Ruby via terminal, please contact me: m.k@mk16.de
I would be glad if you let me know about this case.

Example

rubyapi = require "rubyapi"
api = rubyapi:new()
print(api:version())
print(api:interpret("puts 1; puts 2", true))
api:close()

Output: [Ruby version]
1
2