Lua: expose more map and player infos#4804
Merged
Loobinex merged 8 commits intoMay 22, 2026
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
This PR extends the Lua scripting API by exposing additional map- and player-related information (and allowing some of it to be modified from Lua), primarily via a new Map singleton and additional Player fields.
Changes:
- Registers a new global Lua
Mapobject with readable map metadata and a writabledefault_texture. - Extends Lua
Playerfield accessors to exposetype,max_creatures,player_name, andcolour, and adds setters forplayer_nameandcolour. - Updates build output list to compile the new
lua_api_map.ctranslation unit.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| src/lua_api.c | Registers Map_register() so the new Map singleton is available to Lua. |
| src/lua_api_player.c | Adds new Lua-visible player fields and setters (name/colour) to the Player API. |
| src/lua_api_map.c | Introduces the Map Lua singleton and exposes map metadata + texture setter. |
| Makefile | Adds lua_api_map.o to the object list for non-CMake builds. |
| config/fxdata/lua/classes/Player.lua | Updates Lua class annotations for newly exposed Player fields. |
| config/fxdata/lua/classes/Map.lua | Adds Lua class annotations for the new Map singleton. |
Comments suppressed due to low confidence (1)
src/lua_api_map.c:71
- The
Map.map_typevalues don’t match the PR description (Campaign, Freeplay, Multiplayer, Bonus). HereLvKind_IsFreeis exposed as "MapPack" instead of "Freeplay"; please align the returned string(s) with the documented API or update the PR description accordingly.
} else if (ltype & LvKind_IsBonus) {
lua_pushstring(L, "Bonus");
} else if (ltype & LvKind_IsFree) {
lua_pushstring(L, "MapPack");
} else if (ltype & LvKind_IsSingle) {
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
PieterVdc
reviewed
May 21, 2026
PieterVdc
reviewed
May 21, 2026
….com/Shinthoras0815/keeperfx into Lua-expose-more-map-and-player-infos
PieterVdc
approved these changes
May 22, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Expose additional map and player information to Lua
Map fields:
Player fields: