Documentación de Real

Miscellaneous

HttpGet

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

Sintaxis

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

Argumentos

NombreTipoDescripción
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.

Retornos

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

Descripción

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.

Llamalo con 3 parametro(s): context, url, cache. La tabla de argumentos explica que valores son obligatorios y cuales refinan el comportamiento.

Devuelve body (string). Usa la tabla de retornos para separar valores correctos, resultados nil y errores recuperables.

Ejemplo

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

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