API
lib:NewStorage(globalKey[, callbacks])
Returns a storage object reference that is used for most other actions.
Parameters
- globalKey
- The name of the global variable to create the storage in
- callbacks
- A table containing callback functions in [callback] => function format. See the callbacks page for details.
storageObj:WriteValue(key, value)
Encode a passed table into string format and save it in the specified (string) key.
Parameters
- key
- A string containing the key to use in the storage table. Can contain sub-tables separated by a dot.
- value
- A table to be stored in encoded form.
storageObj:InsertValue(index, value)
Encode a passed table into string format and insert it at the specified (numeric) index.
Parameters
- index
- The numeric index at which the encoded data should be inserted
- value
- A table to be stored in encoded form.
storageObj:ReadIndexed(index)
Decode the data stored in the specified (numeric) index into table form and return it.
Parameters
- index
- The numeric index where the desired data is stored.
Return values
- availableNow
- A boolean indicating whether the requested data was immediately available. If this is false, wait for DECODE_PROGRESS / DECODE_COMPLETE callbacks.
- reqData
- If availableNow is true, this is the requested data.
storageObj:ReadValue(key)
Decode the data stored in the specified (string) key into table form and return it.
Parameters
- index
- The path in the storage object (string) where the desired data is stored.
Return values
- availableNow
- A boolean indicating whether the requested data was immediately available. If this is false, wait for DECODE_PROGRESS / DECODE_COMPLETE callbacks.
- reqData
- If availableNow is true, this is the requested data.
storageObj:WipeValue(key)
Remove the data stored in the specified (string) key or (numeric) index and wipe it from the cache.
Parameters
- key
- The index (numeric) or path in the storage object (string) to the data that should be deleted.
storageObj:NewCallback(callbackKey, callbackFunc)
Register a function to be notified of callback events happening.
Parameters
- callbackKey
- The identifier for the desired callback (string). See the callbacks page for details.
- callbackFunc
- The function to be notified of the callback.
storageObj:WipeCallback(callbackKey, callbackFunc)
Reverses the effect of storageObj:NewCallback, causing the passed function to not be notified of the event any longer.
Comments