added a wget function, because wtf not

This commit is contained in:
Izaya 2017-09-09 22:56:36 +10:00
parent 1406044789
commit 3dff3ce99e
2 changed files with 13 additions and 0 deletions

View File

@ -17,6 +17,7 @@ modules/lib/readline.lua
modules/lib/shutil.lua modules/lib/shutil.lua
modules/lib/sha256.lua modules/lib/sha256.lua
modules/lib/userlib.lua modules/lib/userlib.lua
modules/lib/wget.lua
modules/net/net-ext.lua modules/net/net-ext.lua
modules/applications/login.lua modules/applications/login.lua
modules/applications/luash.lua modules/applications/luash.lua

12
modules/lib/wget.lua Normal file
View File

@ -0,0 +1,12 @@
function wget(url)
local R=component.internet.request(url)
repeat
coroutine.yield()
until R.finishConnect()
S=""
repeat
ns = R.read(2048)
S = S .. (ns or "")
until not ns
return S
end