class Lua::Table
- Lua::Table
- Lua::Base
- Reference
- Object
Included Modules
Defined in:
crystal-lua/base.crInstance Method Summary
- #[](index : Any::Type) : Any | Nil
- #[]=(index : Any::Type, value : Any::Type) : Any::Type
-
#each(& : Tuple(Any, Any) -> )
Must yield this collection's elements to the block.
-
#to_h : Hash(Any, Any)
Creates a
Hash
out of an Enumerable where each element is a 2 element structure (for instance aTuple
or anArray
).
Instance methods inherited from class Lua::Base
ref : Int32
ref,
ref? : Int32 | Nil
ref?
Constructor methods inherited from class Lua::Base
new(state : State, ref : Int32 | Nil)
new
Instance Method Detail
Must yield this collection's elements to the block.
Creates a Hash
out of an Enumerable where each element is a
2 element structure (for instance a Tuple
or an Array
).
[[:a, :b], [:c, :d]].to_h # => {:a => :b, :c => :d}
Tuple.new({:a, 1}, {:c, 2}).to_h # => {:a => 1, :c => 2}