Skip to main content

platform

Store services every platform shares: sign-in, achievements, leaderboards and cloud saves. A call returns an id and answers on a later tick, as a map carrying kindsigned_in, done, scores, read, failed or unsupported — both to the node's on_platform method and to whoever awaits the id. With no store loaded every call answers unsupported, so a script written against this runs anywhere. What only one platform has lives in that platform's own module.

11 functions, 0 constants. Scripts reach it as platform::.

Functions

Argument kinds are the script values a call passes: node is a node handle, any a table or value of any kind, fn a callback.

functionacts onwhat it does
backend() -> anyThe name of the loaded store, or "none".
cloud_read(any, any?, any?) -> anyRead a value the store syncs between the player's devices.
cloud_write(any, any?, any?, any?) -> anyWrite a value for the store to sync between the player's devices.
player() -> anyWho the store says is playing, or nil before a sign-in has landed.
progress(any, any?, any?, any?) -> anyReport an achievement's completion, 0 to 100.
scores(any, any?, any?) -> anyRead a leaderboard's entries. The options take count, start (a rank, from 1), scope ("global" or "friends") and period ("today", "week" or "all_time").
set_presence(any, any?, any?) -> anySay what the player is doing, where the store shows it.
sign_in(any?, any?) -> anyAsk the store who is playing, and return the id its answer carries. A node given here keeps hearing: a later sign-out reaches the same method.
signed_in() -> anyWhether a sign-in has landed.
submit_score(any, any?, any?, any?) -> anyPost a score to a leaderboard.
unlock(any, any?, any?) -> anyAward an achievement whole.