platform module
Store services every platform shares: sign-in, achievements, leaderboards, cloud saves. A call answers later on on_platform_event with a map whose kind…
Store services every platform shares: sign-in, achievements, leaderboards, cloud saves. A call answers later on on_platform_event with a map whose kind is signed_in, signed_out, done, scores, read, error or unsupported, each an EVENT_* constant.
11 functions, 7 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.
| function | acts on | what it does |
|---|---|---|
backend() -> any |
— | The name of the loaded store, or "none". |
cloud_read(any, any?, any?) -> any |
— | Read a value the store syncs between the player's devices. |
cloud_write(any, any?, any?, any?) -> any |
— | Write a value for the store to sync between the player's devices. |
player() -> any |
— | Who the store says is playing, or nil before a sign-in has landed. |
progress(any, any?, any?, any?) -> any |
— | Report an achievement's completion, 0 to 100. |
scores(any, any?, any?) -> any |
— | Read 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?) -> any |
— | Say what the player is doing, where the store shows it. |
sign_in(any?, any?) -> any |
— | Ask 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() -> any |
— | Whether a sign-in has landed. |
submit_score(any, any?, any?, any?) -> any |
— | Post a score to a leaderboard. |
unlock(any, any?, any?) -> any |
— | Award an achievement whole. |
Constants
| name | value |
|---|---|
EVENT_DONE |
done |
EVENT_ERROR |
error |
EVENT_READ |
read |
EVENT_SCORES |
scores |
EVENT_SIGNED_IN |
signed_in |
EVENT_SIGNED_OUT |
signed_out |
EVENT_UNSUPPORTED |
unsupported |