Closed mgerhardy closed 2 months ago
11a1e379449c95e52c91953c75f3e7a7d254bfa2 added the g_http
global for simple GET
downloads. There are no headers possible yet, nor POST
requests with bodies.
http and stream functions are implemented now (and a few others)
an example to download an import a file from the web might look like this
local function basename(str)
local name = string.gsub(str, "(.*/)(.*)", "%2")
return name
end
function main(_, _, _)
local url = "https://github.com/vengi-voxel/vengi/raw/9c101f32b84f949ed82f7545883e80a318760580/data/voxel/guybrush.vox"
local filename = basename(url)
local stream = g_http.get(url)
g_import.scene(filename, stream)
end
with this you are able to connect to generating api - be it images or voxels. Find the details in the docs regarding the lua scripting.
it would be cool to get more script bindings for stuff like streams and http access to connect to external apis via lua scripts.
GET
andPOST
with headers [and body]) (g_http
)g_import
)