File: RUBY_IN_LUA

package info (click to toggle)
rubyluabridge 0.8.0-2
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, sid
  • size: 204 kB
  • sloc: ruby: 928; cpp: 915; makefile: 18; sh: 2
file content (25 lines) | stat: -rw-r--r-- 781 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
== Using Ruby in Lua

==NONE OF THIS IS IMPLEMENTED

==IF YOU HAVE SUGGESTIONS, TELL ME!

Ruby is different in Lua in that there is a single Ruby VM, whereas there can be
many Lua states.  This is represented in Lua as an object in the global table named 'ruby'.

The first thing you need to require the RubyLuaBridge library.  With this object, you can
run Ruby code, load Ruby libraries, and access Ruby objects.

   require 'rubyluabridge'
   print(ruby)    # => userdata: 0x219083

With this +ruby+ object, you can get and set variables and invoke functions.

   ruby.NilClass    --
   ruby.a = 5       -- 
   ruby.print       --

   ruby.eval("print 'hello world'"     # => nil
   ruby.eval("1")                      # => 1
   ruby.eval("'test'")                 # => "test"