Castle
DownloadsGet the Castle client.Frequently Asked QuestionsLearn more about Castle.ExamplesUse this list of examples to bootstrap your game.Quick StartGet started in under 5 minutes.Creating an AccountWhy and how to create a Castle account.Make Your First GameFollow this small tutorial to get oriented with a basic workflow.Describe your Game with a Castle Project FileThis tutorial will provide an overview and motivation for a project file.Adding Games to your ProfileShare games you made by adding them to your profile on Castle.Hosting Your Own GamesLearn how to add games to Castle which are hosted on another service.Game Dimensions and ScalingChange the dimensions and scaling behavior of your Castle game.Manually Make a New Castle Game from ScratchAn educational resource for advanced usersCastle Project File ReferenceThe project file contains the title, description and other metadata about your game.User API ReferenceGet information about users playing your game.Post API ReferenceIntegrate with Castle's post system.Storage API ReferenceStore shared or per-user data in the cloud.Game API ReferenceNavigate to or get information about other games on Castle.UI API ReferenceDisplay user interface elements such as buttons and text boxes that allow users to interact with your game.System API ReferenceGet information about or perform activities relating to the system Castle is running on.Code Loading API ReferenceLow-level functionality for loading Lua code over the network.Community Reference LinksUseful community links for learning about Lua and LÖVE.

User API Reference

The user API lives in the castle.user module. Castle's user API is responsible for retrieving information about the users playing a Castle game.

castle.user.isLoggedIn

A boolean variable indicating whether the user is currently logged in.

castle.user.getMe()

If the user is currently logged into Castle, returns a table of information about the user. The table has the following keys:
  • userId (string): A unique string identifying this user across Castle. It is guaranteed to remain constant through the existence of a user in the Castle network. The string is picked automatically by the Castle system when a new user signs up and remains internal to the system and doesn't get displayed to or edited by the user.
  • username (string): The user's username.
  • name (string): The user's name (a separate field from their username that they can choose on their profile).
  • photoUrl (string): A URL to the image representing the user's profile photo. This URL can be used with love.graphics.newImage to load a LÖVE Image, which you can then draw.
If the user isn't logged in, the function returns nil.