Coppermind
โจ Featuresโ
| Feature | Description |
|---|---|
| ๐พ Schema-Based | Define data structure with templates and automatic reconciliation |
| ๐ Session Locking | Prevent data corruption across multiple servers |
| โฑ๏ธ Auto-Save | Configurable automatic saving intervals |
| ๐ Migrations | Evolve your data schema without losing player data |
| ๐ฑ Transactions | Atomic operations across two stores with rollback |
| ๐งช Mock Mode | Test without hitting real DataStores |
| ๐ก Event-Driven | React to load, save, error, and unload events |
| ๐ง Immutable Data | Deep freeze prevents accidental modifications |
๐ Quick Exampleโ
local Coppermind = require(path.to.Coppermind)
-- ๐ Define a schema
local PlayerSchema = Coppermind.registerSchema({
name = "PlayerData",
dataTemplate = {
coins = 0,
gems = 0,
inventory = {},
stats = {
level = 1,
xp = 0,
},
},
migrations = {},
})
-- ๐ Load a player's data
local store = Coppermind.loadStore(PlayerSchema, tostring(player.UserId), {
sessionLocked = true,
autoSave = 60,
})
-- โ
Wait for data to be ready
store.onReady:Connect(function()
local data = Coppermind.getData(PlayerSchema, tostring(player.UserId))
print("Player has", data.coins, "coins")
end)
-- โ๏ธ Update data safely
Coppermind.updateData(PlayerSchema, tostring(player.UserId), function(data)
data.coins += 100
return nil
end)
๐ What's Next?โ
| Guide | Description |
|---|---|
| Getting Started | Learn the basics and set up your first schema |
| Schemas | Deep dive into data templates and type safety |
| Stores | Master store lifecycle and session locking |
| Transactions | Implement safe trading and transfers |