Envision, Create, Share

Welcome to HBGames, a leading amateur game development forum and Discord server. All are welcome, and amongst our ranks you will find experts in their field from all aspects of video game design and development.

Table.new

Tdata

Sponsor

I would like to know how to use the Table.new class.

Here is what i've tried:
Code:
class Bio_List
  
  @list = Table.new(50, 6)
  
  @list[0,0] = 32                     #item ID
  @list[0,1] = 1                      #zone 
  @list[0,2] = 0                      #lvl Requirement
  @list[0,3] = [1,2,3,4,5,6,10]   #actors able to use it
  @list[0,4] = 0                      #Skill Additions by ID
  @list[0,5] = "head.png"         #icon 

  @list[1,0] = 33
  @list[1,1] = [2,3]
  @list[1,2] = 0
  @list[1,3] = [1,2,3,4,5,6,10]
  @list[1,4] = 0
  @list[1,5] = "arm.png"

end

My problem is that it tries to convert everything into an integer... I was hoping the table class would be able to help me when i'm working with my Bio-mod List.
 
"Table

The multidimensional array class. Each element takes up 2 signed bytes, ranging from -32,768 to 32,767.

Ruby's Array class does not run efficiently when handling large amounts of data, hence the inclusion of this class."

You're best off making a multi-dimensional array, or an array wrapper class.
 

Tdata

Sponsor

I got that from the help file... Does that mean i'll have to use a multi-layered array as in:
@list = []
@list[0] = [32, 1, 0, [1..6,10], 0, "head.png"]
@list[1] = [33, [2, 3], 0, [1..6, 10], 0, "arm.png"]

What i want is to be able to 'visualize' the array like this:
Code:
32	33	34	35
1	2,3	4,5	6
0	0	0	0
1..6,10	1..6,10	1..6,10	1..6,10
0	0	0	0
 

Thank you for viewing

HBGames is a leading amateur video game development forum and Discord server open to all ability levels. Feel free to have a nosey around!

Discord

Join our growing and active Discord server to discuss all aspects of game making in a relaxed environment. Join Us

Content

  • Our Games
  • Games in Development
  • Emoji by Twemoji.
    Top