api
`loreKit.api` (`require("~loreKit.api")`) is loreKit's public surface: define entries (`define`, `get`, `ids`), open and close the reader (`open(id, { style })`, `close`, `current`), the per-player journal (`find`, `markRead`, `journal`, `unread`, `openJournal`, `toggleJournal`,…
api
loreKit.api (require("~loreKit.api")) is loreKit's public surface: define entries (define, get, ids), open and close the reader (open(id, { style }), close, current), the per-player journal (find, markRead, journal, unread, openJournal, toggleJournal, resetJournal, loadJournal from saveKit), the style list (STYLES, STYLE_INFO) and events (on("read"|"found"|"opened"|"closed"|"journal")). Game code, the Lore component and horrorKit call it.
Interface
What this asset declares: the schema it conforms to, what it exposes, and the rendered structured payload.
conforms to
zero/source-extract/v2loreKit's public API: notes, documents and audio logs that tell a game's story. Entries are data (`Lore.define{ id, style, title, body, clip, image, caption }`); a `Lore` component (or `Lore.open(id)`) opens a reader in one of seven styles; found entries go into a per-player journal with an unread marker, saved through saveKit when it is installed. local Lore = require("~loreKit.api") Lore.define({ id = "first_note", style = "note", title = "A torn page", body = "Don't run." }) Lore.open("first_note") -- reader opens, the entry is found and read Lore.on("read", function(e) print(e.id, e.style) end) Lore.openJournal() -- J by default
emit(name: string, payload: any) → void
| arg | type | description |
|---|---|---|
| name | string | |
| payload | any |
on(name: string, fn: (any) → void
Listen on this player's engine. Events: `read{id,style,title,first}` (an entry was opened in the reader; `first` the first time), `found{id,title}` (added to the journal), `opened{id}`, `closed{id,seconds}`, `journal{open}`, `settings{subtitles}`. Returns a disconnect function.
| arg | type | description |
|---|---|---|
| name | string | |
| fn | (any |
define(e: any) → void
Add or replace an entry: `{ id, style, title, body, author?, date?, clip?, subtitles?, image?, caption?, variant? }`. `clip` is a soundClip (ref or a loreKit clip name), `subtitles` a list of `{ at = seconds, text }` (made from the body's sentences when absent), `image` a texture reference or loreKit image name.
| arg | type | description |
|---|---|---|
| e | any |
get(id: string) → any
An entry by id (a copy), or nil.
| arg | type | description |
|---|---|---|
| id | string |
ids( ) → void
Every entry id, sorted.
saveKit( ) → any
persist( ) → void
loadJournal( ) → void
Load the journal from saveKit (the host calls this once saveKit is ready). Entries found this session are kept.
_journalLoaded( ) → boolean return loadedFromSave end
persistSettings( ) → void
loadSettings( ) → boolean
Load this player's reader settings from saveKit (the host calls this with the journal). A choice made this session before saveKit was ready wins and is written back.
setSubtitles(on: boolean) → void
Turn the tape reader's timed subtitles on or off for this player (a settings menu toggle). Saved in this player's saveKit profile when saveKit is linked; an open tape redraws at once. Fires `settings{subtitles}`. Default on.
| arg | type | description |
|---|---|---|
| on | boolean |
subtitles( ) → boolean return Settings
Whether this player sees tape subtitles (`Lore.setSubtitles`). Default true.
find(id: string) → boolean
Add an entry to this player's journal without opening it. Returns true the first time.
| arg | type | description |
|---|---|---|
| id | string |
markRead(id: string) → void
Mark an entry read (opening it in the reader does this).
| arg | type | description |
|---|---|---|
| id | string |
journal( ) → void
This player's journal, oldest first: `{ { id, title, style, read } }`.
unread( ) → number
How many found entries are still unread.
isFound(id: string) → boolean return J
| arg | type | description |
|---|---|---|
| id | string |
isRead(id: string) → boolean return J
| arg | type | description |
|---|---|---|
| id | string |
resetJournal( ) → void
Forget the journal (a new game). Also clears it in saveKit.
hostComponent( ) → string
ensureHost( ) → void
Make sure this engine's lore host runs (play mode only): it ticks the reader, listens for the close and journal keys, and draws the unread marker.
_attach(id: string) → void
| arg | type | description |
|---|---|---|
| id | string |
_detach(id: string) → void
| arg | type | description |
|---|---|---|
| id | string |
open(id: string, opts: any?) → void
Open an entry in the reader on this player's screen: finds it, marks it read and fires `read`. opts: `style` (show it in another style), `source` (the entity it came from), `subtitles` (true/false: override the player's subtitle setting for this open). Reading pauses nothing; the world keeps running for everyone.
| arg | type | description |
|---|---|---|
| id | string | |
| opts | any? |
close( ) → void
Close the reader (or the journal) if open.
current( ) → string
Whether the reader is showing an entry: its id, or nil.
openJournal( ) → void
Open this player's journal: every found entry, unread ones marked; picking one opens it.
toggleJournal( ) → void
Toggle the journal.
_reset( ) → void
Tests only: drop listeners and the journal.
Sub-parts
Everything contained inside this part. Assets are composite children (clickable cards). Files are leaf payloads. Expand any row to view its source.
Showing up to 3 levels deep. Open a part to see what it holds further down.
Problems
Everything affecting this asset right now: its own problems, anything wrong inside it, and problems on its direct dependencies.
agent_score is exposed.+ quality × 0.35
+ performance × 0.25
± compat factor
Usability ratings
Did the part work as advertised when consumers tried to drop it in. Separate from upvotes: those are taste; this is "did it function".
Scoped to this part · feeds back into the world's score.