Log Streams
Simple file I/O helper for reading and writing logged stream data in JSON, wikitable, and reStructuredText formats.
Simple file I/O helper for reading and writing logged stream data in JSON, wikitable, and reStructuredText formats.
Overview
util_logStreams provides basic read/write functions for three file formats: JSON, wikitable (.txt), and reStructuredText (.rst). Used for persisting logged stream data to disk.
Extension path: lua/ge/extensions/util/logStreams.lua
Exports (M)
| Function | Signature | Description |
|---|---|---|
saveJson | (data) | Writes data as pretty JSON to loggedStreams.json. |
readJson | () | Reads and returns parsed JSON from loggedStreams.json. |
saveWikitable | (data) | Writes string data to loggedStreams.txt. |
readWikitable | () | Reads loggedStreams.txt, escaping newlines as \n. |
saveRst | (data) | Writes string data to loggedStreams.rst. |
readRst | () | Reads loggedStreams.rst, escaping newlines as \n. |
Internals
File Paths
| Format | File |
|---|---|
| JSON | loggedStreams.json |
| Wikitable | loggedStreams.txt |
| RST | loggedStreams.rst |
Read Behavior
The readWikitable and readRst functions replace newlines with literal \n strings using gsub('\n', '\\n'). This is a workaround to return the entire file as a single-line string suitable for embedding.
How It Works
- Use
saveJson(data)to persist structured data. - Use
readJson()to load it back. - Wikitable and RST variants work with raw string data.
Lua Examples
-- Save stream data as JSON
extensions.util_logStreams.saveJson({streams = {"stream1", "stream2"}})
-- Read it back
local data = extensions.util_logStreams.readJson()
dump(data)
-- Save as wikitable format
extensions.util_logStreams.saveWikitable("{| class='wikitable'\n|+ Streams\n|}")
-- Read wikitable (newlines escaped)
local wiki = extensions.util_logStreams.readWikitable()Additional Exports
M.readJson- (undocumented)M.readRst- (undocumented)M.readWikitable- (undocumented)M.saveJson- (undocumented)M.saveRst- (undocumented)M.saveWikitable- (undocumented)
JBeam Stats
Generates statistics about all JBeam files in the game - part counts, section usage, line counts, and modifier counts.
Map Tiles
Generates orthographic map tile images at multiple zoom levels for use with web map viewers (e.g., Leaflet). Includes an ImGui control panel with progress tracking.