Module pl.classx
extra classes: MultiMap, OrderedMap and Typed List.
Functions
Tables
Functions
- MultiMap:set (key, val)
-
add a new value to a key.
Parameters:
-
key
: the key
-
val
: the value
- MultiMap:update (t)
-
update a MultiMap using a table.
Parameters:
-
t
: either a Multimap or a map-like table.
- OrderedMap:iter ()
-
iterate over key-value pairs in order.
- OrderedMap:keys ()
-
return the keys in order. (Not a copy!)
- OrderedMap:set (key, val)
-
set the key's value.
Parameters:
-
key
: the key
-
val
: the value
- OrderedMap:sort (cmp)
-
sort the keys.
Parameters:
- OrderedMap:update (t)
-
update an OrderedMap using a table.
Parameters:
- OrderedMap:values ()
-
return the values in order. this is relatively expensive.
- TypedList:append (val)
-
append a value to the list. Will throw an error if the value is not of the correct type.
Parameters:
-
val
: a value of the correct type.
Return value:
- TypedList:extend (L)
-
extend the list using another list.
Parameters:
-
L
: a list of the same type.
Return value:
- TypedList:slice (i1, i2)
-
return a slice of the list
Parameters:
-
i1
: start of slice
-
i2
: end of slice
Return value:
See also:
Tables
- TypedList
- construct a specific TypedList. For example, class.StringList(TypedList,'string')