Namespace: poki_sdk
Language: Lua
Type: Extension
Functions and constants for interacting with Poki SDK APIs
Type: FUNCTION Signals that gameplay has started.
Type: FUNCTION Signals that gameplay has stopped.
Type: FUNCTION Requests a commercial break. The callback reports START if an ad starts and SUCCESS when Poki’s commercial-break promise resolves.
Parameters
callback (function)
self (object) - The calling script instancestatus (number) - One of the statuses: poki_sdk.COMMERCIAL_BREAK_START, poki_sdk.COMMERCIAL_BREAK_SUCCESSType: FUNCTION Requests a rewarded break. The size argument is optional and defaults to small. Call it as rewarded_break(callback) or rewarded_break(size, callback).
Parameters
size (string) - Optional reward size. Accepted values are small, medium, and large. Defaults to small.callback (function)
self (object) - The calling script instancestatus (number) - One of the statuses: poki_sdk.REWARDED_BREAK_ERROR, poki_sdk.REWARDED_BREAK_START, poki_sdk.REWARDED_BREAK_SUCCESSType: FUNCTION Enables or disables Poki SDK debug mode.
Parameters
is_debug (boolean)Type: FUNCTION Captures and reports an error to Poki.
Parameters
error (string)Type: FUNCTION Deprecated: Poki no longer exposes ad-block detection. This compatibility function always returns false.
Returns
boolean - Always false.Type: FUNCTION Generates a shareable URL with the supplied parameters.
Parameters
params (table) - String or number values to include in the generated URL.callback (function)
self (object) - The calling script instanceurl (string) - The generated shareable URL.Type: FUNCTION Returns the URL parameter value provided by Poki. The Defold bridge maps a null or undefined result to nil.
Parameters
key (string)Returns
['string', 'nil'] - The parameter value, or nil when the Poki result is null or undefined.Type: FUNCTION
Sends a custom analytics event to Poki. Use start/complete/fail for progress, visible/interact for offer and UI engagement, or a custom action for other events. Do not duplicate commercial or rewarded ad playback and outcomes; Poki tracks those through the ad calls. The binding defaults omitted what and action to empty strings for compatibility.
Parameters
category (string)what (string |
nil) - Optional event subject. Defaults to an empty string when omitted. |
action (string |
nil) - Optional event action. Defaults to an empty string when omitted. |
Type: FUNCTION Moves the Poki pill to a different vertical position.
Parameters
topPercent (number) - Position from the top in percent.topPx (number) - Additional position offset in pixels.Type: FUNCTION
Type: FUNCTION Retrieves the currently logged-in Poki user.
Parameters
callback (function)
self (object) - The calling script instanceuser (table |
nil) - A table with username and avatar_url, or nil if no user is logged in. |
error (string |
nil) - The rejection message, or nil if the request completed normally. |
Type: FUNCTION Retrieves the Poki auth token for the currently logged-in user.
Parameters
callback (function)
self (object) - The calling script instancetoken (string |
nil) - The short-lived Poki auth token, or nil if no user is logged in. |
error (string |
nil) - The rejection message, or nil if the request completed normally. |
Type: FUNCTION Prompts the player to log in to their Poki account.
Parameters
callback (function)
self (object) - The calling script instancesuccess (boolean) - true if the login promise resolved, otherwise false.error (string |
nil) - The rejection message on failure, or nil on success. |
Type: FUNCTION Opens an external link in a new browser tab for user-initiated external navigation.
Parameters
url (string)Type: VARIABLE A commercial break finished or did not display.
Type: VARIABLE A commercial break started.
Type: VARIABLE A rewarded break failed or the reward should not be granted.
Type: VARIABLE A rewarded break completed and the reward may be granted.
Type: VARIABLE A rewarded break started.