Closed Yonaba closed 11 years ago
FEATURE AS INTENDED ... WE MUST WATCH YOU PLAY YOUR GAMES ~NSA
But seriously, this is a bug, I didn't think http.request
would throw an error when the internet wasn't accessible, which is why I only ever checked it against if e == 200 then
.
Thank you, I will get this fixed asap!
I cloned the repo on my laptop, and recreated the issue by disabling the wireless.
Commit cf36937eb59586847cb759973e479f1d5ffa3e4b seems to fix this problem, @Yonaba please tell me if this fixes it for you as well!
Close if we're golden.
We're golden. :+1:
In case Vapor was already run once (and game.json along with some other data) was saved, and then after, Vapor is executed again, but being offline, it crashes on trying to update
game.json
.The problem lies in src/core/remote.lua in function
remote.load
. Since it always receives no arg from main.lua,force_local
is alwaysnil
. Then, the condition:is traversed, and then
http.request
fails, of course.A possible workaround can be making use of pcall:
But I believe that this would shadow the possible use of
force_local
(maybe meant for debugging). An alternative way (which can be mixed with the previous) would be adding some custom function in main.lua to check for connection, and set a boolean accordingly that will be passed toremote.load
.The
running_local
arg will behave asforce_local
in src/core/remote.lua. As I am not familiar (at all) with LuaSocket and internet stuff, I won't implement it myself, otherwise I would have sent a proper pull request.Sorry for being that long.
Regards, Roland.