Skip to content

Instantly share code, notes, and snippets.

@johnX9
Last active April 30, 2018 17:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save johnX9/67a76f8a54d2297b817eba683dfc329d to your computer and use it in GitHub Desktop.
Save johnX9/67a76f8a54d2297b817eba683dfc329d to your computer and use it in GitHub Desktop.
//@abi action
void getplayer(const account_name account) {
playerIndex players(_self, _self);
auto iterator = players.find(account);
eosio_assert(iterator != players.end(), "Address for account not found");
/**
* The "get" function returns a constant reference to the object
* containing the specified secondary key
*/
auto currentPlayer = players.get(account);
print("Username: ", currentPlayer.username.c_str(), " Level: ", currentPlayer.level, " Health: ", currentPlayer.health_points, " Energy: ", currentPlayer.energy_points);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment