Miscellaneous

HttpGet

Performs a GET request for game:HttpGet(url, cache) or game:HttpGetAsync(url, cache) and returns the response body string.

Syntax

HttpGet(context: DataModel, url: string, cache?: boolean | number): string

Argumente

NameTypBeschreibung
contextDataModelMethod-call self value. Use game:HttpGet(url, cache) or game:HttpGetAsync(url, cache).
urlstringURL string to request.
cache?boolean | numberOptional cache control. true or numeric 1 enables the URL cache.

Rückgaben

NameTypBeschreibung
bodystringDownloaded response body string, cached body string, or an empty string when the request cannot be opened.

Beschreibung

Performs a GET request for game:HttpGet(url, cache) or game:HttpGetAsync(url, cache) and returns the response body string. The URL must pass Real's URL restrictions.

Rufe es mit 3 Parameter(n) auf: context, url, cache. Die Argumenttabelle erklärt, welche Werte erforderlich sind und welche nur das Verhalten verfeinern.

Es gibt body (string) zurück. Nutze die Rückgabetabelle, um erfolgreiche Werte von nil-Ergebnissen und behandelbaren Fehlern zu trennen.

Beispiel

Run a DataModel-style GET request and return the response body string.

local body = game:HttpGet("https://example.com", true)
print(body)