class

Lua::Table

Inherits Iterable / Enumerable / Lua::Object / Reference / Object

Instance methods

[](index)

Returns the value at index or nil if there is no value at all.

t[2] = "test"
t[2] # => "test"
Source
[]=(index, value)

Sets a new value at index into a table.

t[3] = "test"
t[3] # => "test"
Source
each

Implements Enumerable. Traverses a table in Lua stack using next.

Source
each

Implements Iterable

Source
next

Implements Iterator. Traverses a table in Lua stack using next.

Source
to_h

Converts this table to Crystal hash.

t[1] = "a"
t["io"] = "b"
t[:gog] = "c"
t.to_h # => {"gog" => "c", 1.0 => "a", "io" => "b"}
Source
to_s(io : IO)

Represents table as a string.

t      # => [1.1, 2.1, 3.1]
t.to_s # => #3 {1.0 => 1.1, 2.0 => 2.1, 3.0 => 3.1}
Source