Class: Table
- Inherits:
-
Object
- Object
- Table
- Defined in:
- lib/eidolon/rgssx/table.rb
Overview
RGSSx
This class is present and consistent across all RGSS versions.
Table
The multidimensional array class. Each element is an integer of 2 signed bytes ranging from -32,768 to 32,767.
Instance Attribute Summary collapse
-
#xsize ⇒ Object
readonly
Size of the Table’s X dimension.
-
#ysize ⇒ Object
readonly
Size of the Table’s Y dimension.
-
#zsize ⇒ Object
readonly
Size of the Table’s Z dimension.
Instance Method Summary collapse
-
#[](x, y = 0, z = 0) ⇒ Object
Accesses the array’s elements.
-
#to_s ⇒ Object
(also: #inspect)
Provides object inspection identical to that provided by RGSSx.
Instance Attribute Details
#xsize ⇒ Object (readonly)
Size of the Table’s X dimension.
9 10 11 |
# File 'lib/eidolon/rgssx/table.rb', line 9 def xsize @xsize end |
#ysize ⇒ Object (readonly)
Size of the Table’s Y dimension.
12 13 14 |
# File 'lib/eidolon/rgssx/table.rb', line 12 def ysize @ysize end |
#zsize ⇒ Object (readonly)
Size of the Table’s Z dimension.
15 16 17 |
# File 'lib/eidolon/rgssx/table.rb', line 15 def zsize @zsize end |
Instance Method Details
#[](x, y = 0, z = 0) ⇒ Object
Accesses the array’s elements. Pulls the same number of arguments as there are dimensions in the created array. Returns nil
if the specified element does not exist.
20 21 22 23 |
# File 'lib/eidolon/rgssx/table.rb', line 20 def [](x, y = 0, z = 0) return nil if x >= @xsize || y >= @ysize @data[x + y * @xsize + z * @xsize * @ysize] end |
#to_s ⇒ Object Also known as: inspect
Provides object inspection identical to that provided by RGSSx.
26 27 28 |
# File 'lib/eidolon/rgssx/table.rb', line 26 def to_s "#<Table:0x#{(object_id << 1).to_s(16)}>" end |