Skip to content

Commit

Permalink
Added friends.setRichPresence()
Browse files Browse the repository at this point in the history
  • Loading branch information
oniietzschan committed Dec 5, 2020
1 parent f2655e6 commit 8aa6bf8
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ Install luajit (`brew install luajit`). Run `make osx`.

### Windows 32 and 64

We'll use [chocolatey](https://chocolatey.org). Install VS and mingw (`choco install visualstudio20127community visualstudio2017-workload-nativecrossplat mingw`). Then run `mingw32-make windows32` for Windows 32 and `mingw32-make windows64` for Windows 64.
We'll use [chocolatey](https://chocolatey.org). Install VS and mingw (`choco install visualstudio2017community visualstudio2017-workload-nativecrossplat mingw`). Then run `mingw32-make windows32` for Windows 32 and `mingw32-make windows64` for Windows 64.

## Resources
- [Steam API Reference](https://partner.steamgames.com/doc/api)
Expand Down
12 changes: 11 additions & 1 deletion src/friends.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,13 +62,23 @@ EXTERN int luasteam_getFriendPersonaName(lua_State *L) {
return 1;
}

// bool SetRichPresence( const char *pchKey, const char *pchValue );
EXTERN int luasteam_setRichPresence(lua_State *L) {
const char *key = luaL_checkstring(L, 1);
const char *value = luaL_checkstring(L, 2);
bool success = SteamFriends()->SetRichPresence(key, value);
lua_pushboolean(L, success);
return 1;
}

namespace luasteam {

void add_friends(lua_State *L) {
lua_createtable(L, 0, 3);
lua_createtable(L, 0, 4);
add_func(L, "activateGameOverlay", luasteam_activateGameOverlay);
add_func(L, "activateGameOverlayToWebPage", luasteam_activateGameOverlayToWebPage);
add_func(L, "getFriendPersonaName", luasteam_getFriendPersonaName);
add_func(L, "setRichPresence", luasteam_setRichPresence);
lua_pushvalue(L, -1);
friends_ref = luaL_ref(L, LUA_REGISTRYINDEX);
lua_setfield(L, -2, "friends");
Expand Down

0 comments on commit 8aa6bf8

Please sign in to comment.