GlyEngine 0.4
Create games and apps with lua
Loading...
Searching...
No Matches
Storage

Functions

local function as (name, cast)
local function callbacks (handler)
local function default (value)

Detailed Description

  • empty string is nil
  • the API is assycronous
Precondition
require storage

GET (storage)

Example
std.storage.get('name'):as('name'):run()
local function as(name, cast)

SET (storage)

Example
std.storage.set('name', data.name):run()

Function Documentation

◆ as()

local function as ( name ,
cast  )

updates the current Node data.

Example
std.storage.get('streak')
:as('streak_loaded', true)
:as('streak', tonumber)
:run()

◆ callbacks()

local function callbacks ( handler )

result handler.

Example
std.storage.get('highscore')
:callback(function(value)
data.highscore = std.math.max(data.highscore, tonumber(value))
end)
:run()

◆ default()

local function default ( value )