From abduct:
currently suspended so bear that in mind.
anyways i am not entirely sure what you are trying to acomplish and i suggest simply opening up IRB and running some simple tests.
also there is a structure to variables in ruby and i am unsure why you are setting "this" to an instance variable.
if you havent figured out variables are like so,
Code
this, that, something |are all normal variables
:this, :that, :something |are all string symbols
This, That, Something |are all constant variables
$this, $that, $something |are all global variables
@this, @that, @something |are all instence variables
@@this, @@that, @@something |are all global class variables
difference between @ and @@ is that @ is a variable pertaining to that class that was initialized, while @@ variables can be accessed by any class of that type which is initiliazed.
as for your array question there are different ways to handle this.
first way which is possibly the easiest is to create an array and then push your datasets to the array as a array.
Code
test = []
test.push [x.to_i, y.to_i]
puts test[0][0]
puts test[0][1]
next would be creating an array with predetermaned number of elements
Code
test = Array.new(10) { Array.new(2) }
=> [[nil, nil], [nil, nil], [nil, nil], [nil, nil], [nil, nil], [nil, nil], [nil, nil], [nil, nil], [nil, nil], [nil, nil]]
personally i would create a single dimontional array and push arrays into the exisisting array, much easier to manage then working with a prebuilt array its dynamically built and you only add as many elements as you need. further you can still use push, pop, shift methods to add to the end, take off the end, or take off the front of the array.
This post was edited by Rikuo on Jun 6 2013 11:09am