Dict - FireDragon91245/Lua-Linq GitHub Wiki

linq.dict

Creates or clones a dictionary-style collection. A dict stores key/value pairs and inherits the full enumerable pipeline API.

Constructor overloads

linq.dict(): dict<any, any>
linq.dict<K, V>(table: { [K]: V }): dict<K, V>
linq.dict<K, V>(existing_dict: dict<K, V>): dict<K, V>
linq.dict<K, V>(enumerable: enumerable<K, V>): dict<K, V>
linq.dict<K, V>(iter: iter<K, V>): dict<K, V>
linq.dict(table: table): dict<any, any>

Inherited API

dict inherits all enumerable methods such as distinct, where, select, collect, any, max, min, fork, spread, first, last, iter, and tolist. The pages in this section only cover dict-specific behavior.

Unique methods

  • dict:keys() returns an enumerable of keys.
  • dict:values() returns an enumerable of values.
  • dict:enumerate() returns the key/value enumerable wrapper.
  • dict:iter() returns a direct key/value iterator.

Examples

local resources = linq.dict({ iron = 30, copper = 45 })
local from_iter = linq.dict(linq.dict({ iron = 4, copper = 7 }):iter())
⚠️ **GitHub.com Fallback** ⚠️