Last active
August 29, 2015 14:16
-
-
Save creationix/f87eb113a7ebad8ba186 to your computer and use it in GitHub Desktop.
Build this sample with `lit make gist://creationix/f87eb113a7ebad8ba186`. No need to clone, simply install latest lit first.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- Load some libraries | |
local uv = require('uv') | |
local request = require('coro-http').request | |
local jsonParse = require('json').parse | |
-- Run our logic in a coroutine for blocking coro-I/O | |
coroutine.wrap(function () | |
-- Make an http request | |
local res, body = request("GET", "http://lit.luvit.io/packages/creationix") | |
-- Print the results | |
p(res) | |
p(jsonParse(body)) | |
-- Stop the event loop | |
uv.stop() | |
end)() | |
-- Start the event loop | |
uv.run() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
return { | |
name = "creationix/gist-test", | |
version = "0.0.0", | |
private = true, | |
dependencies = { | |
"luvit/require", | |
"luvit/pretty-print", | |
"luvit/json", | |
"creationix/coro-http" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment