neyuki 0.3.0

A small Lua-like scripting language implemented in Rust
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
-- Fetch a JSON document over HTTPS and print the response.

local http = require("@neyuki/http")
local io = require("@neyuki/io")

local url = "https://httpbin.org/get?" .. http.query({ lang = "neyuki", version = 1 })
local response = http.get(url, { headers = { accept = "application/json" }, timeout = 15 })

local outcome = "failed"
if (response.ok) then outcome = "ok" end
io.write(response.status, " ", outcome, " from ", response.url, "\n")
io.write("content-type: ", response:header("Content-Type") ?? "?", "\n")
io.write(response.body, "\n")