Those requests are async (and could be made sync if that is your choice)
The wrapper is REALLY easy to use and there is no adaptation is required between those platform (Except web where you need to include a
Code: Select all
<script src="consolewrapper.js"></script>
For using it, just
Code: Select all
require "REST"
function love.load()
-- URL REQUEST-HEADER(TABLE FORMAT) ONLOAD
REST.get("https://example.com", nil, function(data)print(data);end)
end
function love.update(dt)
REST.retrieve(dt)
end
- GET
- POST
- PUT
- DELETE
- HEAD
- PATCH
Module-Loader
You can easily other fully-pledged libraries into your project without adapting anything:
Code: Select all
require "module-loader"
-- LIBPATH FILE
requireFromLib("js", "js")
requireFromLib("luajit-request", "luajit-request")
In this lib you can still find:
Async(Coroutine)Loader + LoadBar
With that, you can pass your own load function, it will be executed on the coroutine, it is a singleton
LoadBar is a simple bar that you can pass your own backFrame and frontFrame and render it(Doesn't use stencil yet), for using it, is very simple, and if not texture is provided, it uses a default rect for loading(nice for testing):
Code: Select all
require "loadbar"
loadBarInstance = LoadBar:new(width, height, frontTexture, backTexture)
imgs = {}
loadBarInstance.addContentToLoad(function()
imgs["myImg"] = love.graphics.newImage("myImg.png")
end, nil, "Loading myImg: $")
Then, you just need to call in love.update
Code: Select all
loadBarInstance:update(dt)
REST-love