This is specifically for Lua developers making it a bit easier for profile management.
Short description of methods:
DB:New( datascope, key, defaults, defaultprofile )
Returns a new database with datascope, key, default table, and the defaultprofile.
Ex:
mydb = DB:New( Turbine.DataScope.Server, "MyAddon", Defaults, Defaults )
DB:CopyProfile( profile )
Returns a copy of a profile.
Ex:
mydb.profiles["Destination"] = mydb:CopyProfile( mydb.profiles["Defaults"] )
DBeleteProfile( profile )
Sets profile to nil and saves databse.
Ex:
mydb
eleteProfile()
DB:SetCurrentProfile( profile )
Sets DB.profiles["ACTIVE"] to the profile name field and saves the database.
Ex:
mydb:SetCurrentProfile( mydb.profiles["Defaults"] )
DB:GetCurrentProfile()
Returns DB.profiles["ACTIVE"]
Ex:
local current = mydb:GetCurrentProfile()
DB:RegisterDefaults( defaultstable )
Used to create DB.profiles["Defaults"], set it equal to defaultstable, and set DB.profiles["ACTIVE"] to "Defaults" if the active profile is not already defined.
It then saves the database.
Ex:
mydb:RegisterDefaults( Defaulttable )
DB:ResetDB( defaultprofile )
Sets DB.profiles to nil, adds the default table into the profiles, registers the default table, and saves the database.
Ex:
mydb:ResetDB( Defaulttable )
DB:SaveDB()
Saves the database.
Ex:
mydb:SaveDB()
DB:NewProfile( name )
Returns a copy of DB.profiles["Defaults"] as DB.profiles[name]
Ex:
mydb:NewProfile( "MyNewProfileName" )
v0.3 10/17/2010:
Updated Copyprofile error that was left out before upload.