Assets
Read project assets from scripts.
Namespace: caffeine.assets
loadText#
Lua: caffeine.assets.loadText
text
loadText(path) -> string
Loads a text file. A failure returns the error text rather than raising, so check what you get back.
| Parameters | Type | Description |
|---|---|---|
path | string | Asset path; also searched under the project root, assets/, data/ and data/assets/. |
Returns: string. The file text (cached); on failure the error message; nil without a loader.
Example
lua
local json = caffeine.assets.loadText('data/items.json')