Giter Club home page Giter Club logo

gamejoltlua's People

Contributors

itsmapleleaf avatar pablomayobre avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

gamejoltlua's Issues

Issue with empty highscore table

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

Bugs with Quick Play

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

GJ.setData doesnt work

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

Repetitive functions

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

Having a LÖVE user in GameJolt

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

Add usage documentation.

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!

Cache trophies

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

Async requests?

Seems like requests freeze an app for a few seconds.
Certainly, need a way to find a solution to make it more.. async?

Is http.lua required?

Can't this just be a dependency, instead of included in the repo?

Love supplies socket.http and works just fine without it.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.