Created
July 28, 2012 06:01
-
-
Save d4l3k/3192016 to your computer and use it in GitHub Desktop.
Ruby To LSL Converter
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
tristan@tristan-G41M-ES2L:~/Dropbox/ruby2lsl$ ./convert.rb test.rb | |
File: /home/tristan/Dropbox/ruby2lsl/test.rb | |
Sexp: s(:class, :Default, nil, s(:scope, s(:block, s(:defn, :initialize, s(:args), s(:scope, s(:block, s(:call, nil, :puts, s(:arglist, s(:str, "Hello world!"))), s(:call, nil, :puts, s(:arglist, s(:dstr, "This is a number ", s(:evstr, s(:call, s(:lit, 5), :+, s(:arglist, s(:lit, 5)))), s(:str, " and then an imbedded funciton "), s(:evstr, s(:call, nil, :llToUpper, s(:arglist, s(:str, "dolfin")))))))))), s(:defn, :touch_start, s(:args, :num_detected), s(:scope, s(:block, s(:call, nil, :puts, s(:arglist, s(:dstr, "", s(:evstr, s(:lvar, :num_detected)), s(:str, " people touched me! OMG! the first guy was "), s(:evstr, s(:call, nil, :llDetectedName, s(:arglist, s(:lit, 0))))))))))))) | |
Converted: | |
default | |
{ | |
state_entry( ) | |
{ | |
llOwnerSay( "Hello world!" ); | |
llOwnerSay( "This is a number " + (string)( 5 +( 5 ) ) + " and then an imbedded funciton " + (string)llToUpper( "dolfin" ) ); | |
} | |
touch_start( integer num_detected ) | |
{ | |
llOwnerSay( "" + (string)num_detected + " people touched me! OMG! the first guy was " + (string)llDetectedName( 0 ) ); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
default | |
{ | |
state_entry( ) | |
{ | |
llOwnerSay( "Hello world!" ); | |
llOwnerSay( "This is a number " + (string)( 5 +( 5 ) ) + " and then an imbedded funciton " + (string)llToUpper( "dolfin" ) ); | |
} | |
touch_start( integer num_detected ) | |
{ | |
llOwnerSay( "" + (string)num_detected + " people touched me! OMG! the first guy was " + (string)llDetectedName( 0 ) ); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Default | |
def initialize | |
puts "Hello world!" | |
puts "This is a number #{5 + 5} and then an imbedded funciton #{llToUpper("dolfin")}" | |
end | |
def touch_start num_detected | |
puts "#{num_detected} people touched me! OMG! the first guy was #{llDetectedName(0)}" | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment