DataStore allows you to store data (string/table) to a specific key in the database table. All you have to do is enter your database information in settings.lua('sqlite' or 'mysql') and once connected you can use the datastore exported functions to store and/or get data from the db table. Very useful for beginner developers who lack experience with MySQL/SQLite.
Fairly easy to use.
This function returns the database, if there is one at least.
Returns the database connection if one was connected.
This function stores data into a specific key in the connected database table.
exports['datastore']:storeData(string key, string/table value)
- string key: Key that the data is gonna be stored in
- string/table value: Data to be stored in the key (tables are automatically stored as a string)
Returns true if the data was stored successfully.
This function gets the data stored in a specific key.
- string key: Key that you would like to receive the data of.
Returns the data that was stored in the key if found. (converted tables to strings are automatically returned as tables)
This function gets all the keys and data stored in the connected database table.
Returns table of all the data received from the connected database table. Key names being the index value, value being the data of the key.