Exports
- Added
- Updated
Client side
useBlankBook
Turns the used blank book into a new book and opens the editor.
ox_inventory calls it through client.export in the item definition. You do not call it yourself.
| Argument | Type | Description |
|---|---|---|
data | table | Passed by ox_inventory |
slot | { name: string, slot: integer, metadata: table } | The used slot |
exports.REC_Books:useBlankBook(data, slot)
useBook
Opens the book in metadata.bookUid of the used slot: for editing when its author can still edit it, for reading otherwise.
ox_inventory calls it through client.export in the item definition. You do not call it yourself.
| Argument | Type | Description |
|---|---|---|
data | table | Passed by ox_inventory |
slot | { name: string, slot: integer, metadata: table } | The used slot |
exports.REC_Books:useBook(data, slot)
isBookOpen
Tells you whether a book is on screen.
Takes no arguments. Returns boolean.
exports.REC_Books:isBookOpen()
closeBook
Closes the book on screen without saving.
Takes no arguments.
exports.REC_Books:closeBook()
Server side
A book is identified by its uid, which the rec_book item carries as metadata.bookUid.
These exports read and write the database, so call them from a thread.
setHidden, purgeImages and deleteBook run as the console, so the moderation webhook names the console as the staff member.
getBookMeta
Gives you the manifest of a book.
| Argument | Type | Description |
|---|---|---|
uid | string | Book uid |
Returns BookManifest?, nil when the book does not exist or the tables are missing:
| Field | Type | Description |
|---|---|---|
uid | string | Book uid |
title | string | Title, empty until one is set |
status | "draft" | "sealed" | sealed once bound |
hidden | boolean | Hidden by staff |
authorName | string | Character name of the author |
pageOrder | string[] | Page ids in order |
orderRev | integer | Revision of the page order |
bytes | integer | Stored size of the whole book |
surfaceRevs | table<string, integer> | Revision of each saved surface |
sealedAt | integer? | When the book was bound |
exports.REC_Books:getBookMeta(uid)
setHidden
Hides or shows a book. Hiding closes it on the screen of everyone reading it.
| Argument | Type | Description |
|---|---|---|
uid | string | Book uid |
hidden | boolean | true hides, false shows |
Returns boolean.
exports.REC_Books:setHidden(uid, hidden)
purgeImages
Removes every picture layer of a book.
| Argument | Type | Description |
|---|---|---|
uid | string | Book uid |
Returns integer, the number of layers removed.
exports.REC_Books:purgeImages(uid)
deleteBook
Deletes a book and its pages. The items stay and say the book is missing.
| Argument | Type | Description |
|---|---|---|
uid | string | Book uid |
Returns boolean.
exports.REC_Books:deleteBook(uid)
