Showcase your libraries, tools and other projects that help your fellow love users.
Ulydev
Party member
Posts: 445 Joined: Mon Nov 10, 2014 10:46 pm
Location: Paris
Contact:
Post
by Ulydev » Thu Jan 05, 2017 2:00 pm
Hello,
Here's a little lib that implements async HTTP requests.
It's mainly designed for web REST APIs.
Code: Select all
local wapi = require "webapi"
function love.update(dt)
wapi.update()
end
request = wapi.request({
method = "GET",
url = "http://jsonplaceholder.typicode.com/posts/1"
}, function (body, headers, code)
print(body)
end)
Check it out on
Github
CrackedP0t
Citizen
Posts: 69 Joined: Wed May 07, 2014 4:01 am
Contact:
Post
by CrackedP0t » Sat Jan 07, 2017 9:18 pm
This is cool... but it would be even cooler if it used coroutines! For example:
Code: Select all
local wapi = require "webapi"
function love.update(dt)
wapi.update()
end
wapi.do(function()
body, headers, code = wapi.request({
method = "GET",
url = "http://jsonplaceholder.typicode.com/posts/1"
})
print(body)
end)
/人 ◕‿‿◕ 人\
Here, have an umlaut. Ö
zorg
Party member
Posts: 3465 Joined: Thu Dec 13, 2012 2:55 pm
Location: Absurdistan, Hungary
Contact:
Post
by zorg » Sat Jan 07, 2017 10:47 pm
If speed is an issue, then don't use coroutines, since luaJIT can't/doesn't compile them.
Otherwise, go for it.
Me and my stuff True Neutral Aspirant. Why, yes, i do indeed enjoy sarcastically correcting others when they make the most blatant of spelling mistakes. No bullying or trolling the innocent tho.
alberto_lara
Party member
Posts: 372 Joined: Wed Oct 30, 2013 8:59 pm
Post
by alberto_lara » Sun Jan 08, 2017 6:52 am
Cool, I'm going to definitely check it out
Users browsing this forum: No registered users and 4 guests