📜  roblox http 请求 - 任何代码示例

📅  最后修改于: 2022-03-11 14:58:24.533000             🧑  作者: Mango

代码示例1
local HttpService = game:GetService("HttpService") local URL_ASTROS = "http://api.open-notify.org/astros.json" -- Make the request to our endpoint URLlocal response = HttpService:GetAsync(URL_ASTROS) -- Parse the JSON responselocal data = HttpService:JSONDecode(response) -- Information in the data table is dependent on the response JSONif data.message == "success" then    print("There are currently " .. data.number .. " astronauts in space:")    for i, person in pairs(data.people) do        print(i .. ": " .. person.name .. " is on " .. person.craft)    endend