luasteam
repository·master·Indexed 42 days ago
https://github.com/uspgamedev/luasteamA library providing Lua bindings for the SteamWorks API, enabling Steam integration for games built with Lua engines such as Love2D. It includes a Rust-based generator for automatically creating C++ bindings from steam_api.json and supports interfaces like ISteamApps for managing DLC, installation status, and launch parameters.
What's inside luasteam
- luasteam provides Lua bindings for the SteamWorks API. It is designed to allow developers to integrate Steam features (such as achievements, matchmaking, and more) into Lua-based game engines, most notably Love2D.
Overview of available luasteam examples
masterThe repository includes several example projects to verify different aspects of the
luasteamintegration:basic: Verifies thatluasteamcan be imported without crashing and checks that basic interfaces and enums are correctly initialized. Does not require Steam to be running.basic_love: Verifiesluasteamimport and output functionality using the LOVE2D framework. Does not require Steam to be running.socket_client/socket_server: Demonstrates and tests the socket API by running a client and server pair.sdk_readonly_smoke: An end-to-end smoke test for various Steam SDK functions. It uses only read-only or safe calls to avoid side effects. It covers:User,Friends,Apps,Utils,Networking,RemoteStorage,UGC,Matchmaking, andUserStatscallbacks.
Overview of the ISteamInput API
masterThe
ISteamInputAPI provides access to Steam Input functionality, allowing developers to manage controller input, action sets, haptics, and device connectivity.Key capabilities include:
- Action Management: Activating/deactivating action sets and layers, and retrieving action handles (analog and digital).
- Input Polling: Retrieving digital and analog action data, as well as motion data.
- Haptics: Triggering vibration and haptic events.
- Device Management: Monitoring controller connections and managing gamepad indices.
- UI/UX: Showing the Steam binding panel and retrieving glyphs (PNG/SVG) for UI elements.
Note: Methods in this documentation may be marked with:
- 🤖: Automatically generated bindings.
- ✍️: Manually implemented methods.
- ✋: Currently not implemented.
Use the ISteamController API
masterThe
ISteamControllerinterface provides access to Steam Controller features, including action sets, input data (analog and digital), haptic feedback, and controller LED control.Note on method symbols:
- 🤖: Automatically generated bindings.
- ✍️: Manually implemented methods.
- ✋: Currently not implemented.
Reference the ISteamMatchmaking API
masterThe
Matchmakingmodule provides access to Steam's matchmaking services, allowing you to create and manage lobbies, search for compatible members, and handle lobby-based communication.Note on documentation symbols:
- 🤖: Automatically generated bindings.
- ✍️: Manually implemented methods.
- ✋: Currently not implemented.
Key functional areas include:
- Lobby Management: Creating, joining, leaving, and setting properties (type, joinability, owner) for lobbies.
- Lobby Data: Setting and retrieving metadata for lobbies and individual members.
- Lobby Search: Requesting lists of lobbies and applying various filters (numerical, string, slots available, distance, etc.).
- Communication: Sending and receiving chat messages within a lobby.
- Favorites: Managing a user's favorite games list.
Use ISteamNetworkingUtils for network utilities
masterThe
NetworkingUtilsinterface provides a suite of tools for managing network-related tasks in Steam, including ping estimation, relay network status, IP address manipulation, and configuration management.Key capabilities include:
- Ping & Latency: Estimating ping between locations or from localhost, and checking ping data freshness.
- Relay Networking: Initializing relay access and monitoring relay network status.
- IP & Identity Management: Parsing and converting Steam networking IP addresses and identities to/from strings, and handling 'Fake IP' types.
- Configuration: Setting and retrieving global or connection-specific configuration values (Float, Int32, String).
- Callbacks: Registering for network status changes and session updates.
Use Enums and Constants in v5
masterIn v5, all C++ enum constants are exposed as plain integers directly on the
Steamtable using their exact C++ names. You should no longer use strings to pass enum values to functions; pass the integer constant instead.Access Pattern:
Steam.<CppConstantName>Examples:
Steam.k_EItemStateInstalled(Value: 4)Steam.k_ELeaderboardSortMethodDescending(Value: 2)Steam.k_ESteamNetworkingSend_Reliable(Value: 8)
Comparison:
if data.m_eResult ~= Steam.k_EResultOK then print("Error:", data.m_eResult) endUnderstand the ISteamClient interface
masterThe
ISteamClientinterface provides core Steam functionality. Inluasteam, this interface is accessible via multiple accessors depending on your context. While the documentation refers to it asClient, it can also be accessed asGameServerClient(e.g.,Steam.GameServerClient).Methods in this documentation are categorized as:
- 🤖 Auto-generated: Automatically created bindings from SteamWorks.
- ✍️ Manually implemented: Custom Lua implementations.
- ✋ Not implemented: Methods that are currently blocked or unavailable (typically custom accessors like
GetISteamUser).
Use the ISteamHTTP interface
masterThe
ISteamHTTPinterface provides methods for making HTTP requests, managing cookies, and handling HTTP responses.Note that this interface can be accessed through multiple accessors depending on your context (for example, a
GameServervariant). While the documentation refers to it asHTTP, you may need to access it viaGameServerHTTPin certain environments.Initialize Steam Structs with Constructors
masterMost Steam-related data structures in
luasteamare provided as userdata instances. You can create a new instance of a struct using its correspondingSteam.new<StructName>_t([table])constructor.Passing an optional
tableto the constructor allows you to set initial field values immediately upon creation.-- Example: Creating a struct with initial values local myStruct = Steam.newGameServerChangeRequested_t({ m_rgchServer = "my_server_address", m_rgchPassword = "secret_password" })Access the ISteamNetworking interface
masterTheISteamNetworkinginterface provides networking capabilities for Steam games. Note that this interface can be accessed through multiple accessors depending on your context. While the documentation refers to it asNetworking, it may also be available viaGameServerNetworking(e.g., for a GameServer variant).Handle Steam Networking Messages callbacks
masterThe
ISteamNetworkingMessagesinterface provides two primary callbacks for managing session lifecycles:OnSteamNetworkingMessagesSessionRequest: Triggered when a remote user attempts to start a session. Thedataobject containsm_identityRemote(theSteamNetworkingIdentityof the requester).OnSteamNetworkingMessagesSessionFailed: Triggered when a session fails. Thedataobject containsm_info(SteamNetConnectionInfo_t), which includes the end reason (m_eEndReason).
function Steam.NetworkingMessages.OnSteamNetworkingMessagesSessionFailed(data) print('Messages session failed:', data.m_info.m_eEndReason) end