class BinData::Array

def [](arg1, arg2 = nil)

Returns the element at +index+.
def [](arg1, arg2 = nil)
  if arg1.respond_to?(:to_int) && arg2.nil?
    slice_index(arg1.to_int)
  elsif arg1.respond_to?(:to_int) && arg2.respond_to?(:to_int)
    slice_start_length(arg1.to_int, arg2.to_int)
  elsif arg1.is_a?(Range) && arg2.nil?
    slice_range(arg1)
  else
    raise TypeError, "can't convert #{arg1} into Integer" unless arg1.respond_to?(:to_int)
    raise TypeError, "can't convert #{arg2} into Integer" unless arg2.respond_to?(:to_int)
  end
end