mirror of
https://github.com/ctruLua/ctruLua.git
synced 2025-10-28 00:39:30 +00:00
"Fixed" the HTTPC lib with the crappiest code you've ever seen, Added a (very) small QTM lib
Don't look at the HTTPC code !!! Also, the example only work a random number of times.
This commit is contained in:
parent
2f27ea317c
commit
d3ca4d0360
4 changed files with 165 additions and 24 deletions
37
sdcard/3ds/ctruLua/tests/httpc.lua
Normal file
37
sdcard/3ds/ctruLua/tests/httpc.lua
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
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.startFrame(gfx.GFX_TOP)
|
||||
gfx.text(0, 0, data)
|
||||
gfx.endFrame()
|
||||
|
||||
gfx.render()
|
||||
end
|
||||
|
||||
|
||||
context:close()
|
||||
--httpc.shutdown()
|
||||
Loading…
Add table
Add a link
Reference in a new issue