Log inGet started
Package

ideas.module

Newest version

This package holds more than this page lists. See all of its files in its world.

README.md

launcher.ideas

The idea words of the create screen: which words a field shows, what a pick does to the idea, the sentence the picks read as, and the curated sets Surprise me picks from.

The words are ZeroMind's idea-word pools (GET /v1/idea-words/{locale}), which the trusted VM reads (trusted.call("launcher.ideaWords", locale)), with a copy the engine ships for an offline first run. Each pool has a slug, the share of the field it is given (slots) and its words, each with an id that reads the same in every language, the text it shows and the weight it is drawn at. The pools are grouped into six facets a person reads by a glyph and a hue: Play, Place, Things, Twist, Mood and Look.

Everything here is pure: the caller hands it the pools, the picks, a random source and the catalog lookup that writes the sentence.

Example

local Ideas = require("@builtin::modules.api.engine.launcher.ideas")
local pools = trusted.call("launcher.ideaWords", i18n.locale()).words
local field = Ideas.draw(pools, 24, {}, function(n) return math.random() * n end)
local picks = {}
Ideas.pick(picks, field[1])
print(Ideas.compose(picks, i18n.t))