This repository has been archived on 2024-09-19. You can view files and clone it, but cannot push or open issues or pull requests.
gamejoltlua/README.md

64 lines
2.4 KiB
Markdown
Raw Permalink Normal View History

2015-02-05 18:11:27 +00:00
# GameJolt.lua
Provides access to GameJolt's services for Lua-based projects.
2015-08-18 19:42:37 +00:00
# Projects using gamejolt.lua
[One Bit Arena](http://gamejolt.com/games/one-bit-arena/41484)
[Random Rooms](http://gamejolt.com/games/random-rooms/85035)
2015-02-05 18:11:27 +00:00
# Usage
Put the files from the repo into your app's folder.
```lua
local GJ = require "gamejolt"
GJ.init(gameID, gameKey)
GJ.authUser(username, usertoken)
GJ.openSession()
-- your further manipulations
```
Haxe-styled interface for GameJolt module:
```haxe
interface GameJolt {
2015-03-01 13:08:56 +00:00
static var username:String;
static var userToken:String;
2015-02-05 18:11:27 +00:00
static var isLoggedIn:Bool;
2015-03-01 13:08:56 +00:00
static function init(id:Int, key:String, ?args:Dynamic):Void;
2015-02-05 18:11:27 +00:00
// users
static function authUser(name:String, token:String):Bool;
static function fetchUserByName(name:String):UserInfo;
static function fetchUserByID(id:Int):UserInfo;
2015-03-01 13:08:56 +00:00
static function getCredentials(dir:String):Dynamic;
2015-02-05 18:11:27 +00:00
// sessions
static function openSession():Bool;
static function pingSession(active:Bool):Bool;
static function closeSession():Bool;
// data store
static function fetchData(key:String, ?isGlobal:Bool):Dynamic;
static function setData(key:String, data:Dynamic, ?isGlobal:Bool):Bool;
2015-03-01 19:49:02 +00:00
static function setBigData(key:String, data:Dynamic, ?isGlobal:Bool):Bool;
2015-02-05 18:11:27 +00:00
static function updateData(key:String, value:String, operation:String, ?isGlobal:Bool):String;
static function removeData(key:String, ?isGlobal:Bool):Bool;
static function fetchStorageKeys(?isGlobal:Bool):Array<String>;
// trophies
static function giveTrophy(id:Int):Bool;
static function fetchTrophy(id:Int):TrophyInfo;
static function fetchTrophiesByStatus(achieved:Bool):Array<TrophyInfo>;
static function fetchAllTrophies():Array<TrophyInfo>;
// scores
static function addScore(score:Float, desc:String, ?tableID:Int, ?guestName:String, ?extraData:String):Bool;
static function fetchScores(limit:Int, ?tableID:Int):Array<ScoreInfo>;
static function fetchTables():Array<TableInfo>;
}
```
2015-02-06 12:12:41 +00:00
Visit [wiki](https://github.com/insweater/gamejoltlua/wiki) / [docs](http://gamejolt.com/api/doc/game/) for more information.
2015-02-05 18:11:27 +00:00
# Credits
GameJolt.lua is using kikito's [MD5](https://github.com/kikito/md5.lua) and [LuaSocket](http://w3.impa.br/~diego/software/luasocket/home.html).
# License (MIT)
2015-03-01 13:08:56 +00:00
Copyright (c) 2015 [@insweater](http://github.com/insweater), [@Positive07](http://github.com/Positive07) and team.
2015-02-05 18:11:27 +00:00
This library is released under the [MIT](http://opensource.org/licenses/MIT) license.