|
|
@ -354,7 +354,9 @@ module DFHack
|
|
|
|
end
|
|
|
|
end
|
|
|
|
def empty? ; length == 0 ; end
|
|
|
|
def empty? ; length == 0 ; end
|
|
|
|
def flatten ; map { |e| e.respond_to?(:flatten) ? e.flatten : e }.flatten ; end
|
|
|
|
def flatten ; map { |e| e.respond_to?(:flatten) ? e.flatten : e }.flatten ; end
|
|
|
|
def index(elem=nil, &b) ; (0...length).find { |i| b ? b[self[i]] : self[i] == elem } ; end
|
|
|
|
def index(e=nil, &b) ; (0...length).find { |i| b ? b[self[i]] : self[i] == e } ; end
|
|
|
|
|
|
|
|
def first ; self[0] ; end
|
|
|
|
|
|
|
|
def last ; self[length-1] ; end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
class StaticArray < MemStruct
|
|
|
|
class StaticArray < MemStruct
|
|
|
|
attr_accessor :_tglen, :_length, :_indexenum, :_tg
|
|
|
|
attr_accessor :_tglen, :_length, :_indexenum, :_tg
|
|
|
|