ldoc return fixes

This commit is contained in:
2026-02-26 17:41:06 +01:00
parent e56662f6ad
commit 337f1fc132
21 changed files with 279 additions and 262 deletions

View File

@@ -6,14 +6,15 @@ local _maps = {}
--- Gets all registered maps as an array.
--- @within Map
--- @return result table An array of registered map data.
--- @return result.id string Unique map identifier.
--- @return result.from_x number Source tile X coordinate in the map sheet.
--- @return result.from_y number Source tile Y coordinate in the map sheet.
--- @return result.width number Width in tiles.
--- @return result.height number Height in tiles.
--- @return result.to_x number Destination X coordinate on screen.
--- @return result.to_y number Destination Y coordinate on screen.
--- @return result table An array of registered map data. </br>
--- Fields: </br>
--- * id (string) Unique map identifier.<br/>
--- * from_x (number) Source tile X coordinate in the map sheet.<br/>
--- * from_y (number) Source tile Y coordinate in the map sheet.<br/>
--- * width (number) Width in tiles.<br/>
--- * height (number) Height in tiles.<br/>
--- * to_x (number) Destination X coordinate on screen.<br/>
--- * to_y (number) Destination Y coordinate on screen.<br/>
function Map.get_maps_array()
local maps_array = {}
for _, map_data in pairs(_maps) do
@@ -25,13 +26,13 @@ end
--- Registers a map definition.
--- @within Map
--- @param map_data table The map data table.
--- @param map_data.id string Unique map identifier.
--- @param map_data.from_x number Source tile X coordinate in the map sheet.
--- @param map_data.from_y number Source tile Y coordinate in the map sheet.
--- @param map_data.width number Width in tiles.
--- @param map_data.height number Height in tiles.
--- @param map_data.to_x number Destination X coordinate on screen.
--- @param map_data.to_y number Destination Y coordinate on screen.
--- @param map_data.id string Unique map identifier.<br/>
--- @param map_data.from_x number Source tile X coordinate in the map sheet.<br/>
--- @param map_data.from_y number Source tile Y coordinate in the map sheet.<br/>
--- @param map_data.width number Width in tiles.<br/>
--- @param map_data.height number Height in tiles.<br/>
--- @param map_data.to_x number Destination X coordinate on screen.<br/>
--- @param map_data.to_y number Destination Y coordinate on screen.<br/>
function Map.register(map_data)
if _maps[map_data.id] then
trace("Warning: Overwriting map with id: " .. map_data.id)
@@ -42,14 +43,15 @@ end
--- Gets a map by ID.
--- @within Map
--- @param map_id string The ID of the map.
--- @return result table The map data table or nil.
--- @return result.id string Unique map identifier.
--- @return result.from_x number Source tile X coordinate in the map sheet.
--- @return result.from_y number Source tile Y coordinate in the map sheet.
--- @return result.width number Width in tiles.
--- @return result.height number Height in tiles.
--- @return result.to_x number Destination X coordinate on screen.
--- @return result.to_y number Destination Y coordinate on screen.
--- @return result table The map data table or nil. </br>
--- Fields: </br>
--- * id (string) Unique map identifier.<br/>
--- * from_x (number) Source tile X coordinate in the map sheet.<br/>
--- * from_y (number) Source tile Y coordinate in the map sheet.<br/>
--- * width (number) Width in tiles.<br/>
--- * height (number) Height in tiles.<br/>
--- * to_x (number) Destination X coordinate on screen.<br/>
--- * to_y (number) Destination Y coordinate on screen.<br/>
function Map.get_by_id(map_id)
return _maps[map_id]
end