1
0
Fork 0
mirror of https://github.com/ctruLua/ctruLua.git synced 2025-10-27 16:39:29 +00:00
ctruLua/sdcard/3ds/ctruLua/tests/httpc.lua
Reuh b87b2676e6 gfx.GFX_TOP, gfx.GFX_BOTTOM, gfx.GFX_LEFT, gfx.GFX_RIGHT -> gfx.TOP, gfx.BOTTOM, gfx.LEFT, gfx.RIGHT
Also commented and moved tests/audio to examples/audio because the code is quite clean, and we lack examples.
2015-12-30 19:15:46 +01:00

37 lines
727 B
Lua

local ctr = require("ctr")
local gfx = require("ctr.gfx")
local hid = require("ctr.hid")
local httpc = require("ctr.httpc")
local err = 0
--assert(httpc.init())
local context = assert(httpc.context())
assert(context:open("http://firew0lf.github.io/"))
assert(context:beginRequest())
local data = assert(context:downloadData())
while ctr.run() do
hid.read()
keys = hid.keys()
if keys.held.start then break end
if keys.down.b then
assert(context:open("http://firew0lf.github.io/"))
assert(context:beginRequest())
data = assert(context:downloadData())
data = (data.."!")
end
gfx.start(gfx.TOP)
gfx.text(0, 0, data)
gfx.stop()
gfx.render()
end
context:close()
--httpc.shutdown()