Elements Manual
Elements 2 Manual
Elements 2 Manual
  • Welcome 👋
  • QUICK START
    • Elements in Five Minutes or Less
  • General
    • General Concepts
    • N-Tier Architecture
    • Security Model
  • SCRIPTING ENGINE
    • Scripting Engine Overview
      • Intro to Resources and Cloud Functions
      • Horizontal Scaling Model
      • Database Access
      • Server-to-Server API Calls
      • Deploy Cloud Functions via Git
      • Creating and Destroying Resources
      • Cross-Resource Invocation
      • Indexing Resources
      • Coroutines
      • Manifest
  • Core Features
    • Core API Overview
    • Sessions
    • Applications
      • Facebook Application Configuration
      • Firebase Application Configuration
      • Amazon GameOn Application Configuration
      • iOS Application Configuration
      • Android Application Configuration
      • Matchmaking Application Configuration [deprecated]
    • Users and Profiles
    • Digital Goods
    • Progress and Missions
    • Leaderboards
    • Matchmaking
    • Followers
    • Friends
    • Reward Issuance
    • Push Notifications
    • Auth Schemes
    • Save Data
    • Schemas and Metadata Specifications
    • Queries
      • Base Query Syntax
      • Boolean Queries
      • Object Graph Navigation
      • Advanced Operators
        • .ref
        • .name
  • Web 3
    • Omni Chain Support
    • Vaults
    • Wallets
    • Smart Contracts
      • Smart Contracts: Ethereum
      • Smart Contracts: Flow
      • Smart Contracts: Solana
      • Smart Contracts: Neo
    • Know Your Customer
      • Formidium
  • CONFIGURATION
    • Using the Web Console
    • iOS and Android Product Bundles
    • Direct Database Access and Batch Configuration
  • UNITY PLUG-INS
    • Unity Plugin
    • Content Delivery Management and Unity CDN Plugin
  • DEPLOYMENT
    • Deployment Overview
      • Docker Containers
      • AWS Deployment
      • Standalone docker-compose
  • LUA SAMPLES
    • lua Samples
      • main.lua
      • event.lua
      • hello_world.lua
      • model.lua
      • startup.lua
      • HTTP Manifest
        • Example endpoint handler
        • Example operations table
  • RESTful APIs
    • Swagger and Swagger UI
    • Elements 3.0.X (Preview)
      • Applications
      • Friends and Followers
      • Digital Goods and Inventory
      • Leaderboards
      • Missions and Rewards
      • User and Profiles
      • Save Data
      • Custom Metadata
Powered by GitBook
On this page
  1. SCRIPTING ENGINE
  2. Scripting Engine Overview

Intro to Resources and Cloud Functions

Elements can be more powerfully leveraged with stored resource states and cloud functions that take advantage of horizontal scaling and allow asynchronous processing.

PreviousScripting Engine OverviewNextHorizontal Scaling Model

Last updated 2 years ago

What is a Resource?

A resource is a script that can have its state stored to disk. It can be instantiated as many times as you like and linked to any number of paths.

Functions can be called on the resource via an invoke command.

A typical client request makes a round trip that looks like this:

  • Client Makes Request ->

  • HTTP Method (endpoint) Receives Request Data ->

  • Invoke Function On Resource ->

  • Return to HTTP Method ->

  • Send Response to Client.

Any errors that occur along this path would return a 500 error to the client. It's important to appropriately handle all errors, and return error codes accordingly.

Why Should I Use Cloud Functions?

Cloud functions allow you to define how to handle and manipulate data sent from the client. They allow you to interact with resources and leverage Elements' built in to make full use of the cloud. From large-scale asynchronous processing to simply storing user data, cloud functions are versatile and powerful.

horizontal scaling