TweakDB

Methods for interacting with TweakDB, the game's internal data store.

TweakDB methods

DebugStats

TweakDB:DebugStats() -> nil

Print info about the TweakDB. Displays the number of flats, records, and queries, the size in bytes of flatDataBuffer, and the number of created records.

TweakDB:DebugStats()

GetRecord

TweakDB:GetRecord(recordName: string) -> TweakDBRecord

TweakDB:GetRecord(recordID: TweakDBID) -> TweakDBRecord

Get a TweakDB record by name or ID.

sticky_frag = TweakDB:GetRecord("Items.GrenadeFragSticky")

GetRecords

TweakDB:GetRecords(recordTypeName: string) -> table<TweakDBRecord>

Get a table of all TweakDB records under a given type.

Query

TweakDB:Query(queryName: string) -> table<TweakDBID>

TweakDB:Query(queryID: TweakDBID) -> table<TweakDBID>

Get a TweakDB query by name or ID. Returns a table of TweakDBIDs.

GetFlat

TweakDB:GetFlat(flatName: string) -> object

TweakDB:GetFlat(flatID: TweakDBID) -> object

Get a TweakDB flat by name or ID.

SetFlat

TweakDB:SetFlat(flatName: string, newValue: object) -> boolean

TweakDB:SetFlat(flatID: TweakDBID, newValue: object) -> boolean

Set a TweakDB flat by name or ID and update it. Returns whether the flat was successfully set.

SetFlatNoUpdate

TweakDB:SetFlatNoUpdate(flatName: string, newValue: object) -> boolean

TweakDB:SetFlatNoUpdate(flatName: TweakDBID, newValue: object) -> boolean

Set a TweakDB flat by name or ID without updating it. Returns whether the flat was successfully set.

Update

TweakDB:Update(recordName: string) -> boolean

TweakDB:Update(recordID: TweakDBID) -> boolean

TweakDB:Update(recordHandle: TweakDBRecord) -> boolean

Update (flush data of) a TweakDB record by name, ID, or handle. Returns whether the update was successful.

CreateRecord

TweakDB:CreateRecord(recordName: string, recordTypeName: string) -> boolean

TweakDB:CreateRecord(recordID: TweakDBID, recordTypeName: string) -> boolean

Create a new TweakDB record. Returns whether the record was created successfully.

CloneRecord

TweakDB:CloneRecord(recordName: string, clonedRecordName: string) -> boolean

TweakDB:CloneRecord(recordName: string, clonedRecordID: TweakDBID) -> boolean

TweakDB:CloneRecord(recordID: TweakDBID, clonedRecordName: string) -> boolean

TweakDB:CloneRecord(recordID: TweakDBID, clonedRecordID: TweakDBID) -> boolean

Clone an existing record identified by clonedRecordName or clonedRecordID to a new record named recordName or with a TweakDBID of recordID. Returns whether the record was cloned successfully. If a record named recordName or with ID recordID already exists, this method will fail.

DeleteRecord

TweakDB:DeleteRecord(recordName: string) -> boolean

TweakDB:DeleteRecord(recordID: TweakDBID) -> boolean

Delete an existing TweakDB record. Returns whether the record was deleted successfully.

Last updated