Fix almost everything #8
@ -72,22 +72,29 @@ function GJ.init(id, key, args)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
if GJ.username and GJ.userToken then
|
if id and key then --Not sure about this huge check
|
||||||
return true
|
if not args then
|
||||||
|
return true
|
||||||
|
elseif GJ.username and GJ.userToken then
|
||||||
|
return true
|
||||||
|
else
|
||||||
|
return false, "Username or token not found on args"
|
||||||
|
end
|
||||||
else
|
else
|
||||||
return false
|
return false, "Game Id or Game Key was nil"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function GJ.getCredentials()
|
function GJ.getCredentials()
|
||||||
local a = love.system.getOS() == "Windows" and "\\" or "/"
|
local a = love.system.getOS() == "Windows" and "\\" or "/"
|
||||||
local f = io.open(love.filesystem.getWorkingDirectory()..a.."gjapi-credentials.txt")
|
local f = io.open(love.filesystem.getWorkingDirectory()..a.."gjapi-credentials.txt")
|
||||||
|
|
||||||
if f then
|
if f then
|
||||||
GJ.username = f:read()
|
GJ.username = f:read()
|
||||||
GJ.userToken = f:read()
|
GJ.userToken = f:read()
|
||||||
return true
|
return true, GJ.username, GJ.userToken
|
||||||
else
|
else
|
||||||
return false
|
return false, "Couldnt read file"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user