Lua Database Module for FiveM
Hello everyone,
I’m excited to share with you a new resource I’ve been working on: the Lua Database Module for FiveM! This module provides a flexible and easy-to-use way to manage data collections within your FiveM server. Whether you need to store player data, items, quests, or any other kind of information, this module can help simplify the process.
Features
- Easy Integration: Quickly integrate the database module into your FiveM resources.
- Collections: Create and manage data collections for various purposes.
- Auto-Save: Set up timed auto-save to ensure your data is persisted without hassle.
- Customizable Logging: Enable debugging and customize log outputs for easy debugging.
- Usage Examples: Includes detailed usage examples to get you started.
Example Use Case: Player Data Storage
Let’s say you’re looking to store player data efficiently. This module allows you to easily create a player data storage system. Here’s a snippet of what it might look like:
local db = Database.new("resource_name", "path/to/database", true, true, 60000, true)
-- Initialize with collections
db:init({"players", "items", "quests"})
-- Insert data into a collection
db:insert("players", "player123", { name = "John", level = 10 })
-- Update data in a collection
db:update("players", "player123", { level = 11 })
-- Get data from a collection
local playerData = db:get("players", "player123")
-- Search for data in a collection
local playersWithLevel10 = db:searchAll("players", "level", 10)
-- ... and more (see documentation for all available functions)
Documentation
For detailed information about the module’s functions and how to use them, check out the API Documentation.
Download
You can find the Lua Database Module on my GitHub repository. Feel free to download, use, and contribute to the project!
Feedback and Contributions
I’m open to feedback and contributions to make this module even better. If you find any issues or have suggestions, please let me know.
Happy coding!