Lapis
Types
Migration
type Migration = (any) → any | {backwardsCompatible: boolean?,migrate: (any) → any}CollectionOptions<T>
interface CollectionOptions<T> {validate: ((any) → true | (false,string))?--
Takes a document's data and returns true on success or false and an error on fail.
defaultData: T | (key: string) → T--
If set to a function, it's called when a new document is created and is passed the key of the document.
freezeData: boolean?--
If true, data will be deep frozen and can only be updated immutably by calling Document:write. Default: true
migrations: {Migration}?--
Migrations take old data and return new data. Order is first to last. For more information, see: Migrations.
}Functions
setConfig
Types
interface PartialLapisConfig {saveAttempts: number?--
Max save/close retry attempts
loadAttempts: number?--
Max load retry attempts
loadRetryDelay: number?--
Seconds between load attempts
showRetryWarnings: boolean?--
Show warning on retry
dataStoreService: (DataStoreService | table)?--
Useful for mocking DataStoreService, especially in a local place
}Lapis.setConfig({
saveAttempts = 10,
showRetryWarnings = false,
})
-- The default config values:
{
saveAttempts = 5,
loadAttempts = 20,
loadRetryDelay = 1,
showRetryWarnings = true,
dataStoreService = DataStoreService,
}
createCollection
Creates a Collection.