Module DatabankUnit

Stores key/value pairs in a persistent way.

Storage capacity: 30 kB

Element class: DataBankUnit

Extends: Element

Functions

clear () Clear the databank.
getNbKeys () Returns the number of keys that are stored inside the databank.
getKeys () Deprecated: Returns all the keys in the databank.
getKeyList () Returns all the keys in the databank.
hasKey (key) Returns 1 if the key is present in the databank, 0 otherwise.
clearValue (key) Remove the given key if the key is present in the databank.
setStringValue (key, val) Stores a string value at the given key.
getStringValue (key) Returns value stored in the given key as a string.
setIntValue (key, val) Stores an integer value at the given key.
getIntValue (key) Returns value stored in the given key as an integer.
setFloatValue (key, val) Stores a floating number value at the given key.
getFloatValue (key) Returns value stored in the given key as a floating number.
mockGetClosure () Mock only, not in-game: Bundles the object into a closure so functions can be called with "." instead of ":".


Functions

clear ()
Clear the databank.
getNbKeys ()
Returns the number of keys that are stored inside the databank.

Returns:

    int The number of keys.
getKeys ()
Deprecated: Returns all the keys in the databank.

This method is deprecated: getKeyList should be used instead.

Returns:

    json The key list, as JSON sequence.

See also:

getKeyList ()
Returns all the keys in the databank.

Returns:

    list The key list, as a list of string.
hasKey (key)
Returns 1 if the key is present in the databank, 0 otherwise.

Parameters:

  • key

Returns:

    0/1 1 if the key exists and 0 otherwise.
clearValue (key)
Remove the given key if the key is present in the databank.

Parameters:

  • key string The key used to store a value.

Returns:

    0/1 1 if the key has been successfully removed, 0 otherwise.
setStringValue (key, val)
Stores a string value at the given key.

Parameters:

  • key string The key used to store the value.
  • val string The value, as a string.
getStringValue (key)
Returns value stored in the given key as a string.

Parameters:

  • key string The key used to retrieve the value.

Returns:

    string The value as a string.
setIntValue (key, val)
Stores an integer value at the given key.

Parameters:

  • key string The key used to store the value.
  • val int The value, as an integer.
getIntValue (key)
Returns value stored in the given key as an integer.

Parameters:

  • key string The key used to retrieve the value.

Returns:

    int The value as an integer.
setFloatValue (key, val)
Stores a floating number value at the given key.

Parameters:

  • key string The key used to store the value.
  • val float The value, as a floating number.
getFloatValue (key)
Returns value stored in the given key as a floating number.

Parameters:

  • key string The key used to retrieve the value.

Returns:

    float The value as a floating number.
mockGetClosure ()
Mock only, not in-game: Bundles the object into a closure so functions can be called with "." instead of ":".

Returns:

    table A table encompasing the api calls of object.

See also:

generated by LDoc 1.5.0 Last updated 2024-09-27 15:22:46