Caffeine

Assets

Reference Game Last updated: Lua 1 · Dryad 0

Read project assets from scripts.

All namespaces

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.

ParametersTypeDescription
pathstringAsset 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')