lobby v0.0.1 Lobby
This module defines the GenServer that is the lobby GenServer The lobby’s sole purpose is to manage members, their ids, and thei current state.
Link to this section Summary
Functions
Returns the state for the given member id
Returns the map that represents the entire lobby
Creates and returns a new member id and state
Removes the memmber for the given member_id from the lobby
Starts and returns a Lobby GenServer process First argument is the name you want to give the lobby, if any
Updates the member for the given id
Link to this section Functions
get_member(pid | atom, number) :: {:ok, map} | {:error, String.t}
Returns the state for the given member id
Example
iex> Lobby.get_member(:test_lobby, 0)
{:ok, %{}}
Returns the map that represents the entire lobby
Examples
iex> Lobby.lobby(:test_lobby)
{:ok, %{0 => %{}}}
new_member(pid | atom) :: {:ok, {number, map}} | {:error, String.t}
Creates and returns a new member id and state
Example
iex> Lobby.new_member(:test_lobby)
{:ok, {1, %{}}}
Removes the memmber for the given member_id from the lobby
Example
iex> Lobby.remove_member(:test_lobby, 0)
iex> Lobby.get_member(:test_lobby, 0)
{:error, "No member for id"}
Starts and returns a Lobby GenServer process First argument is the name you want to give the lobby, if any.
update_member(pid | atom, number, map) :: :ok
Updates the member for the given id
Example
iex> Lobby.update_member(:test_lobby, 0, %{sweet: :state})
iex> Lobby.get_member(:test_lobby, 0)
{:ok, %{sweet: :state}}