Module objects

Python's basic objects: dict, list and set

Class dict

dict:clear () Clear all the keys and values in the dictionary
dict:contains (key) Check if the dict contains a key
dict:get (key, default) Get the value indexed by the given key in the dictionary
dict:items () List all the key, value pairs in the dictionary
dict:keys () List all the keys in the dictionary
dict:pop (key, default) Pop a value from the dictionary given by key, or return a default
dict:set (key, value) Set the value indexed by given key to given value
dict:update (other) Update keys and values with keys and values in given iterable
dict:values () List all the values in the dictionary

Class list

list:append (value) Append a value to the list
list:clear () Clear the list of all values
list:contains (value) Check if the list contains a value
list:extend (values) Extend the list with the given values
list:index (value) Get index of the requested value in the list
list:insert (index, value) Insert a value into the list at the given index
list:pop (index) Pop a value out of the list at given index.
list:remove (value) Remove a value from list

Class set

set:add (value) Add a value to the set
set:clear () Clear the set of all values
set:contains (value) Check if the set contains a value
set:difference (other) Difference of two sets
set:pop (value) Pop a value out of the set
set:remove (value) Remove a value from the set
set:update (other) Update the set with the values of an object
set:values () List of the values in the set


Class dict

Dict object - mirrors Python's 'dict' api as closely as possible
dict:clear ()
Clear all the keys and values in the dictionary
dict:contains (key)
Check if the dict contains a key

Parameters:

  • key key to check for

Returns:

    boolean is the key in the dict
dict:get (key, default)
Get the value indexed by the given key in the dictionary

Parameters:

  • key key index of dictionary
  • default value to return if key is not in dictionary

Returns:

    value indexed by key if key is in dictionary, otherwise default (nil)
dict:items ()
List all the key, value pairs in the dictionary

Returns:

    pairs iterator
dict:keys ()
List all the keys in the dictionary

Returns:

    list of keys
dict:pop (key, default)
Pop a value from the dictionary given by key, or return a default

Parameters:

  • key key index of dictionary
  • default default value to return
dict:set (key, value)
Set the value indexed by given key to given value

Parameters:

  • key key index of dictionary
  • value value to set at given key
dict:update (other)
Update keys and values with keys and values in given iterable

Parameters:

  • other dictionary to use for update
dict:values ()
List all the values in the dictionary

Returns:

    list of values

Class list

List object - mirrors Python's 'list' api as closely as possible
list:append (value)
Append a value to the list

Parameters:

  • value the value to append
list:clear ()
Clear the list of all values
list:contains (value)
Check if the list contains a value

Parameters:

  • value value to check for

Returns:

    boolean is the value in the list
list:extend (values)
Extend the list with the given values

Parameters:

list:index (value)
Get index of the requested value in the list

Parameters:

  • value the value to index

Returns:

    int index of requested value
list:insert (index, value)
Insert a value into the list at the given index

Parameters:

  • index int the index at which to insert value
  • value value to insert
list:pop (index)
Pop a value out of the list at given index. If index is nil then returns first value in list

Parameters:

  • index int the index of the value in the list

Returns:

    value
list:remove (value)
Remove a value from list

Parameters:

  • value value to remove

Class set

Set object - mirrors Python's 'set' api as closely as possible
set:add (value)
Add a value to the set

Parameters:

  • value
set:clear ()
Clear the set of all values
set:contains (value)
Check if the set contains a value

Parameters:

  • value
set:difference (other)
Difference of two sets

Parameters:

  • other
set:pop (value)
Pop a value out of the set

Parameters:

  • value
set:remove (value)
Remove a value from the set

Parameters:

  • value
set:update (other)
Update the set with the values of an object

Parameters:

  • other
set:values ()
List of the values in the set
generated by LDoc 1.4.6 Last updated 2018-11-10 22:55:04