Skip to content

Instantly share code, notes, and snippets.

@d4l3k
Created July 28, 2012 22:23
Show Gist options
  • Save d4l3k/3195016 to your computer and use it in GitHub Desktop.
Save d4l3k/3195016 to your computer and use it in GitHub Desktop.
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(:lasgn, :potato, s(:lit, 5)), s(:lasgn, :potato, s(:call, s(:lvar, :potato), :+, s(:arglist, s(:lit, 9)))), s(:lasgn, :c, s(:dstr, "silly little people ", s(:evstr, s(:lvar, :potato)))), s(:call, nil, :puts, s(:arglist, s(:dstr, "Hello world! There are some ", s(:evstr, s(:lvar, :c))))), s(:call, nil, :puts, s(:arglist, s(:dstr, "This is a number ", s(:evstr, s(:call, s(:call, s(:lit, 5), :+, s(:arglist, s(:lit, 5))), :+, s(:arglist, s(:lvar, :potato)))), s(:str, " and then an embedded function: "), s(:evstr, s(:call, nil, :llToUpper, s(:arglist, s(:str, "dolfin"))))))), s(:call, nil, :puts, s(:arglist, s(:lvar, :c)))))), s(:defn, :touch_start, s(:args, :num_detected), s(:scope, s(:block, s(:lasgn, :banana_lama, s(:call, s(:call, s(:call, s(:lit, 1), :+, s(:arglist, s(:lit, 2))), :+, s(:arglist, s(:lit, 3))), :-, s(:arglist, s(:lit, 6)))), 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(:lvar, :banana_lama)))), s(:str, ", what a weirdo!"))))))))))
Vartype: potato, Fixnum
+
Vartype: potato, unknown
Vartype: c, unknown
llOwnerSay
llOwnerSay
+
+
llToUpper
llOwnerSay
+
+
-
Vartype: banana_lama, Fixnum
llOwnerSay
llDetectedName
Converted:
default
{
state_entry( )
{
list potato = [5];
potato = [( llList2Integer(potato, 0) +( 9 ) )];
list c = ["silly little people " + (string)llList2Integer(potato, 0)];
llOwnerSay( (string)"Hello world! There are some " + (string)(c) );
llOwnerSay( (string)"This is a number " + (string)( ( 5 +( 5 ) ) +( llList2Integer(potato, 0) ) ) + " and then an embedded function: " + (string)llToUpper( (string)"dolfin" ) );
llOwnerSay( (string)(c) );
}
touch_start( integer num_detected )
{
list banana_lama = [( ( ( 1 +( 2 ) ) +( 3 ) ) -( 6 ) )];
llOwnerSay( (string)"" + (string)(num_detected) + " people touched me! OMG! the first guy was " + (string)llDetectedName( (integer)llList2Integer(banana_lama, 0) ) + ", what a weirdo!" );
}
}
Written to: /home/tristan/Dropbox/ruby2lsl/test.lsl
default
{
state_entry( )
{
list potato = [5];
potato = [( llList2Integer(potato, 0) +( 9 ) )];
list c = ["silly little people " + (string)llList2Integer(potato, 0)];
llOwnerSay( (string)"Hello world! There are some " + (string)(c) );
llOwnerSay( (string)"This is a number " + (string)( ( 5 +( 5 ) ) +( llList2Integer(potato, 0) ) ) + " and then an embedded function: " + (string)llToUpper( (string)"dolfin" ) );
llOwnerSay( (string)(c) );
}
touch_start( integer num_detected )
{
list banana_lama = [( ( ( 1 +( 2 ) ) +( 3 ) ) -( 6 ) )];
llOwnerSay( (string)"" + (string)(num_detected) + " people touched me! OMG! the first guy was " + (string)llDetectedName( (integer)llList2Integer(banana_lama, 0) ) + ", what a weirdo!" );
}
}
class Default
def initialize
potato = 5
potato += 9
c = "silly little people #{potato}"
puts "Hello world! There are some #{c}"
puts "This is a number #{5 + 5 + potato} and then an embedded function: #{llToUpper("dolfin")}"
puts c
end
def touch_start num_detected
banana_lama = 1 + 2 + 3 - 6
puts "#{num_detected} people touched me! OMG! the first guy was #{llDetectedName(banana_lama)}, what a weirdo!"
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment