From 42ec7286b2d36a9ba22925f816a17cb1cc2aa5ce Mon Sep 17 00:00:00 2001 From: chai Date: Sat, 30 Oct 2021 11:32:16 +0800 Subject: + Penlight --- .../Penlight/docs/classes/pl.OrderedMap.html | 417 +++++++++++++++++++++ 1 file changed, 417 insertions(+) create mode 100644 Data/Libraries/Penlight/docs/classes/pl.OrderedMap.html (limited to 'Data/Libraries/Penlight/docs/classes/pl.OrderedMap.html') diff --git a/Data/Libraries/Penlight/docs/classes/pl.OrderedMap.html b/Data/Libraries/Penlight/docs/classes/pl.OrderedMap.html new file mode 100644 index 0000000..537af37 --- /dev/null +++ b/Data/Libraries/Penlight/docs/classes/pl.OrderedMap.html @@ -0,0 +1,417 @@ + + + + + Penlight Documentation + + + + +
+ +
+ +
+
+
+ + +
+ + + + + + +
+ +

Class pl.OrderedMap

+

OrderedMap, a map which preserves ordering.

+

Derived from pl.Map.

+ +

Dependencies: pl.utils, pl.tablex, pl.class, pl.List, pl.Map

+ + +

Methods

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
pl.OrderedMap:_init (t)construct an OrderedMap.
pl.OrderedMap:update (t)update an OrderedMap using a table.
pl.OrderedMap:set (key, val)set the key's value.
pl.OrderedMap:insert (pos, key, val)insert a key/value pair before a given position.
pl.OrderedMap:keys ()return the keys in order.
pl.OrderedMap:values ()return the values in order.
pl.OrderedMap:sort (cmp)sort the keys.
pl.OrderedMap:iter ()iterate over key-value pairs in order.
+

Metamethods

+ + + + + + + + + +
pl.OrderedMap:__pairs ()iterate over an ordered map (5.2).
pl.OrderedMap:__tostring ()string representation of an ordered map.
+ +
+
+ + +

Methods

+ +
+
+ + pl.OrderedMap:_init (t) +
+
+ construct an OrderedMap. + Will throw an error if the argument is bad. + + +

Parameters:

+ + + + + + +
+
+ + pl.OrderedMap:update (t) +
+
+ update an OrderedMap using a table. + If the table is itself an OrderedMap, then its entries will be appended. + if it s a table of the form {{key1=val1},{key2=val2},...} these will be appended.

+ +

Otherwise, it is assumed to be a map-like table, and order of extra entries is arbitrary. + + +

Parameters:

+
    +
  • t + tab + a table. +
  • +
+ +

Returns:

+
    +
  1. + the map, or nil in case of error
  2. +
  3. + the error message
  4. +
+ + + + +
+
+ + pl.OrderedMap:set (key, val) +
+
+ set the key's value. This key will be appended at the end of the map.

+ +

If the value is nil, then the key is removed. + + +

Parameters:

+
    +
  • key + the key +
  • +
  • val + the value +
  • +
+ +

Returns:

+
    + + the map +
+ + + + +
+
+ + pl.OrderedMap:insert (pos, key, val) +
+
+ insert a key/value pair before a given position. + Note: if the map already contains the key, then this effectively + moves the item to the new position by first removing at the old position. + Has no effect if the key does not exist and val is nil + + +

Parameters:

+
    +
  • pos + int + a position starting at 1 +
  • +
  • key + the key +
  • +
  • val + the value; if nil use the old value +
  • +
+ + + + + +
+
+ + pl.OrderedMap:keys () +
+
+ return the keys in order. + (Not a copy!) + + + +

Returns:

+
    + + List +
+ + + + +
+
+ + pl.OrderedMap:values () +
+
+ return the values in order. + this is relatively expensive. + + + +

Returns:

+
    + + List +
+ + + + +
+
+ + pl.OrderedMap:sort (cmp) +
+
+ sort the keys. + + +

Parameters:

+
    +
  • cmp + func + a comparison function as for table.sort +
  • +
+ +

Returns:

+
    + + the map +
+ + + + +
+
+ + pl.OrderedMap:iter () +
+
+ iterate over key-value pairs in order. + + + + + + + +
+
+

Metamethods

+ +
+
+ + pl.OrderedMap:__pairs () +
+
+ iterate over an ordered map (5.2). + + + + + + + +
+
+ + pl.OrderedMap:__tostring () +
+
+ string representation of an ordered map. + + + + + + + +
+
+ + +
+
+
+generated by LDoc 1.4.6 +
+
+ + -- cgit v1.1-26-g67d0