Skip to content

Commit

Permalink
Documentation fixes (closes #9)
Browse files Browse the repository at this point in the history
  • Loading branch information
yancouto committed Apr 10, 2019
1 parent 09a8480 commit 7fa56f2
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 8 deletions.
4 changes: 3 additions & 1 deletion docs/friends.rst
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,9 @@ Callbacks Reference

.. function:: friends.onGameOverlayActivated(data)

:param table data: A table with a single
:param table data: A table similar to `GameOverlayActivated_t <https://partner.steamgames.com/doc/api/ISteamFriends#GameOverlayActivated_t>`_

* **data.active** (`boolean`) -- true if it's just been activated, otherwise false.
:returns: nothing
:SteamWorks: `GameOverlayActivated_t <https://partner.steamgames.com/doc/api/ISteamFriends#GameOverlayActivated_t>`_

Expand Down
8 changes: 4 additions & 4 deletions docs/getting_started.rst
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ becomes
Callbacks
---------

Callbacks work a little different, for example, the ``GameOverlayActivated_t`` callback in ``ISteamUserFriends`` can be used creating a function named ``onGameOverlayActivated`` inside ``userStats``.
Callbacks work a little different, for example, the ``GameOverlayActivated_t`` callback in ``ISteamUserFriends`` can be used creating a function named ``onGameOverlayActivated`` inside ``friends``.

Original code:

Expand All @@ -87,7 +87,7 @@ Original code:

void Listener::OnGameOverlayActivated(GameOverlayActivated_t* data) {
if (data->m_bActive)
printf("Steam overlay now active\n" );
printf("Steam overlay now active\n");
else
printf("Steam overlay now inactive\n");
}
Expand All @@ -96,7 +96,7 @@ Code using luasteam:

.. code-block:: Lua
function Steam.userStats.onGameOverlayActivated(data)
function Steam.friends.onGameOverlayActivated(data)
if data.active then
print("Steam overlay now active")
else
Expand Down Expand Up @@ -171,4 +171,4 @@ They can only be compared for equality or converted to strings (using the `tostr
print("Your id is " .. str)
local id = Steam.extra.parseUint64(str)
-- equality works, even though they are different userdata instances
assert(id == original)
assert(id == original)
41 changes: 38 additions & 3 deletions docs/user_stats.rst
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,11 @@ List of Functions
* :func:`userStats.uploadLeaderboardScore`
* :func:`userStats.downloadLeaderboardEntries`

List of Callbacks
-----------------

* :func:`userStats.onUserStatsReceived`

Function Reference
------------------

Expand Down Expand Up @@ -130,14 +135,14 @@ Function Reference

The equivalent function for other users is :func:`userStats.requestUserStats` **(missing)**.

Triggers a :func:`userStats.userStatsReceived` callback.
Triggers a :func:`userStats.onUserStatsReceived` callback.

**Example**::

-- before any achievement/stats stuff
Steam.userStats.requestCurrentStats()

function Steam.userStats.userStatsReceived()
function Steam.userStats.onUserStatsReceived()
can_do_stats_stuff = true
end

Expand Down Expand Up @@ -328,7 +333,7 @@ Function Reference

* **data[i].details** (`string`) -- Details of the entry. String is used as a byte array, so may contain a ``'\0'`` in the middle.

* **data[i].UGC** (`uint64`) -- Handle for the UGC attached to the entry. A special value if there is none.
* **data[i].UGC** (`uint64`) -- Handle for the UGC attached to the entry. A special value if there is none.

* **err** (`boolean`): **true** if there was any IO error with the request.

Expand Down Expand Up @@ -368,3 +373,33 @@ Function Reference
end
end
end

Callbacks Reference
-------------------

.. warning::

Remember callbacks are functions that you should override in order to receive the events, and not call directly.

Also, you **must** constantly call ``Steam.runCallbacks()`` (preferably in your game loop) in order for your callbacks to be called.


.. function:: userStats.onUserStatsReceived(data)

:param table data: A table similar to `UserStatsReceived_t <https://partner.steamgames.com/doc/api/ISteamUserStats#UserStatsReceived_t>`_

* **data.gameID** (`uint64`) -- Game ID that these stats are for.

* **data.result** (`int`) -- Returns whether the call was successful or not. If the user has no stats, this will be set to 2.

* **data.steamIDUser** (`uint64`) -- The user whose stats were retrieved.
:returns: nothing
:SteamWorks: `UserStatsReceived_t <https://partner.steamgames.com/doc/api/ISteamUserStats#UserStatsReceived_t>`_

Called when the latest stats and achievements for a specific user (including the local user) have been received from the server.

**Example**::

function Steam.userStats.onUserStatsReceived(data)
print('Result: ' .. data.result)
end

0 comments on commit 7fa56f2

Please sign in to comment.