GlyEngine 0.0.17
Create games and apps with lua
Loading...
Searching...
No Matches
Http

Functions

local function fast ()
 reduced response
 
local function body (content)
 
local function param (name, value)
 
local function header (name, value)
 
local function success (handler_func)
 
local function failed (handler_func)
 
local function error (handler_func)
 

Detailed Description

Precondition
require http

GET

std.http.get('https://api.github.com/zen')
:run()

POST

std.http.post('https://example.com.br')
:body('{"foo": "bar"}')
:run()
local function body(content)

Http requests

  • std.http.get
  • std.http.head
  • std.http.post
  • std.http.put
  • std.http.delete
  • std.http.patch

Http responses

  • local handlers
    std.http.get('http://pudim.com.br')
    :success(function()
    print('2xx callback')
    end)
    :failed(function()
    print('4xx / 5xx callback')
    end)
    :error(function()
    print('eg. to many redirects')
    end)
    :run()
    local function success(handler_func)
    local function error(handler_func)
    local function failed(handler_func)
    local function print(pos_x, pos_y, text)
    std.text.print
  • global handler
    local function http(std, game)
    if std.http.error then
    print('eg. https is not supported')
    end
    if std.http.ok then
    print('2xx status')
    end
    if std.http.status > 400 then
    print('2xx / 5xx status')
    end
    end

Function Documentation

◆ body()

local function body ( content )

◆ error()

local function error ( handler_func )

◆ failed()

local function failed ( handler_func )

◆ fast()

local function fast ( )

disconnect when receiving status

◆ header()

local function header ( name ,
value  )

◆ param()

local function param ( name ,
value  )

◆ success()

local function success ( handler_func )