Giter Club home page Giter Club logo

luasdk's Introduction

LuaSdk README

1. Overview:

The PlayFab LuaSdk includes the files needed to make PlayFab HTTPS API calls within a Lua Project.

Current supported platforms:

  • LuaDist console for Windows - Useful for evaluating/debugging
  • Defold - See our Defold Readme
  • Corona - See our Corona Readme
  • If your favorite Lua-engine/environment is not listed, let us know on the Forums.

2. Prerequisites:

To connect to the PlayFab service, your machine must be running TLS v1.2 or better.

3. Contents:

  • PlayFabClientSDK - All files neccessary to make API calls to the PlayFab Client API
  • This is the SDK you should include in your game, and distribute to your players
  • PlayFabServerSdk - All files neccessary to make API calls to the PlayFab Server and Matchmaker API
  • This is the sdk you should optionally include in your live-server (if you have one)
  • For the security of your title, do not distribute any build which contains your devSecretKey
  • PlayFabSdk - Contains all API methods
  • Generally for evaluation or debugging, and some special case live-servers
  • For the security of your title, do not distribute any build which contains your devSecretKey

4. LuaDist Example Instructions:

  • Download PlayFab LuaSdk, copy PlayFabClientSDK/PlayFab into your project folder
  • Specifically, your PlayFabClientApi.lua file should be located: {YourLuaProjectFolder}/PlayFab/PlayFabClientApi.lua
  • Add the following code in your main project (such as: {YourLuaProjectFolder}/main.lua)
local json = require("PlayFab.json")
local PlayFabClientApi = require("PlayFab.PlayFabClientApi")
-- Always set your titleId first, before making any API calls
PlayFabClientApi.settings.titleId = nil -- TODO: Set this to your string titleId you created on PlayFab Game Manager website

-- After the above setup is complete, you can make a Login API call
local loginRequest = {
    -- https://api.playfab.com/Documentation/Client/method/LoginWithCustomID
    CustomId = "TestCustomId",
    CreateAccount = true
}
PlayFabClientApi.LoginWithCustomID(loginRequest, function(result) print("Login Successful: " .. result.PlayFabId) end, function(error) print("Login Failed: " .. error.errorMessage) end)

-- After login, the full client API will fuction properly
-- PlayFabClientApi.GetTitleData( etc etc etc )

Alternately, from the console, you can run the playfab API tests by runing the following console command from windows (Lua.exe must be in your path environment variable):

lua PlayFabTesting/TestPlayFabConsole.lua

5. Defold Example Instructions:

local PlayFabClientApi = require("PlayFab.PlayFabClientApi")
local IPlayFabHttps = require("PlayFab.IPlayFabHttps")
local PlayFabHttps_Defold = require("PlayFab.PlayFabHttps_Defold")

IPlayFabHttps.SetHttp(PlayFabHttps_Defold) -- The auto import magic doens't work if you set the name, so you have to set the reference
PlayFabClientApi.settings.titleId = "6195"

function init(self)
    local loginRequest = {
        -- https://api.playfab.com/Documentation/Client/method/LoginWithCustomID
        CustomId = "TestCustomId",
        CreateAccount = true
    }
    PlayFabClientApi.LoginWithCustomID(loginRequest, function(result) print("Login Successful: " .. result.PlayFabId) end, function(error) print("Login Failed: " .. error.errorMessage) end)
end

-- After login, the full client API will fuction properly
-- PlayFabClientApi.GetTitleData( etc etc etc )
-- Try linking more api calls to buttons!
  • Link the file to a gui script and run!

6. Troubleshooting:

For a complete list of available APIs, check out the online documentation.

Contact Us

We love to hear from our developer community! Do you have ideas on how we can make our products and services better?

Our Developer Success Team can assist with answering any questions as well as process any feedback you have about PlayFab services.

Forums, Support and Knowledge Base

7. Copyright and Licensing Information:

Apache License -- Version 2.0, August 2016 http://www.apache.org/licenses/ Full details available within the LICENSE file.

luasdk's People

Contributors

playfabjenkinsbot avatar mroberti avatar pgilmorepf avatar

Watchers

Rico Moorman avatar James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.