mbrovko / gamejoltlua Goto Github PK
View Code? Open in Web Editor NEWAccess to GameJolt's opportunities for all your lovely Lua projects.
Access to GameJolt's opportunities for all your lovely Lua projects.
Hello, have had problems when trying to fetchScores when the table is empty. Did this to try to fix it, think it works.
if f then
f[k] = v
end
I got this to work in LÖVE, it is really simple, there are two methods to get the data (both of them are rather LÖVE specific)
data = {}
love.load(args)
for k,v in pairs(args) do
local a = v:match("^gjapi_(.*)")
if a then
key, value = a:match("^(.-)=(.-)$")
data[key] = value
end
end
end
local a = love.system.getOS() == "Windows" and "\\" or "/"
local f = io.open(love.filesystem.getWorkingDirectory()..a.."gjapi-credentials.txt")
if f then
data.username = f:read()
data.token = f:read()
end
Both of them should give you data.username
and data.token
if the game was run through Quick Play.
Tested with LÖVE 0.9.1 in Windows 7 32bit
This doesnt seem to work, It never returns success, I got it to work by sending a POST request instead of a GET request, which also gives the full potential of the DataStore. GET request gives up to 8KB per key while POST gives the promised 16MB. I'm pushing the changes I made to the pull request #8
It would be nice to add an MD5 that takes advantage of LuaJIT's bitops!
It would speed up the performance somewhat!
The GJ.pingSession()
function has only two valid forms:
http://gamejolt.com/api/game/v1/sessions/open/?status=active&game_id=GAMEID&format=dump&username=USERNAME&user_token=USERTOKEN&signature=SIGNATURE
http://gamejolt.com/api/game/v1/sessions/open/?status=idle&game_id=GAMEID&format=dump&username=USERNAME&user_token=USERTOKEN&signature=SIGNATURE
and the GJ.closeSession()
function has got just one:
http://gamejolt.com/api/game/v1/sessions/close/?&game_id=GAMEID&format=dump&username=USERNAME&user_token=USERTOKEN&signature=SIGNATURE
I think that once the user calls GJ.openSession()
we could already generate the signatures for this two functions.
I'm suggesting this because pingSession is done once every 30 seconds and that means calculating the hash 120 times in an hour, which I think is pointless
It would be nice to have a LÖVE user in GameJolt, where all of it's friends are Lovers, and we could use his ID and Token as a default one, to get the data when no user is loged in.
We could follow all games made with LÖVE and use the Blog to post about libs, like Yonaba does with his twitter account, it would be really nice... There are also options to link with a Twitter account and LÖVE has one of those.
I would have no problem managing and moderating this, but I would like to have consent from above haha
It would be really nice if the lib was documented as a Lua module instead of having to reference the gamejolt http api.
I'd be willing to add this to the github wiki if you like!
SHA-1 should be better then MD5 encryption, would prevent to use md5 change it to SHA-1
So for the demo I attached on the forum thread, it'd be great if when I asked for my trophy list, it would cache, and GJ.awardTropy()
would update the cache on success, that way I don't need to re-ask the server if the trophy list via GJ.fetchAllTrophies()
I'm wiling to offer a pull request if you like.
Here's my implementiation:
GJ = require "gamejolt"
function love.load()
GJ.init(48003, "01c30651babd8798ee2e972dae7ffc14")
GJ.authUser("josefnpat",170094)
GJ.openSession()
trophies = GJ.fetchAllTrophies()
end
time = 0
function love.update(dt)
time = time + dt
if time > 10 and not time_awarded then
GJ.giveTrophy(16524)
trophies = GJ.fetchAllTrophies()
time_awarded = true
end
end
log = ""
function love.draw()
love.graphics.printf(love.timer.getFPS(),0,0,love.graphics.getWidth(),"right")
local s = ""
for i,v in pairs(trophies) do
s = s .. i .. ":\n"
for j,w in pairs(v) do
s = s .. j .. " - " .. w .. "\n"
end
s = s .. "\n"
end
love.graphics.print(s.."\n\n"..log)
end
function love.mousepressed()
GJ.giveTrophy(16523)
trophies = GJ.fetchAllTrophies()
end
function love.keypressed(key)
if key == "b" then
GJ.giveTrophy(16525)
trophies = GJ.fetchAllTrophies()
end
end
function love.quit()
GJ.closeSession()
end
Seems like requests freeze an app for a few seconds.
Certainly, need a way to find a solution to make it more.. async?
Can't this just be a dependency, instead of included in the repo?
Love supplies socket.http
and works just fine without it.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.