From a902d673778f2afab1943217a975c74605330742 Mon Sep 17 00:00:00 2001 From: alek13 Date: Sat, 20 Sep 2025 05:18:44 +0300 Subject: [PATCH] Modern Lua Plugins: fix errors in `mods/lord/Core/base_classes`. LG-1980 --- classes/InvRef.lua | 4 ++-- classes/ObjectRef/Player.lua | 20 +++++++++++--------- definitions/HUDDefinition.lua | 6 ++++-- minetest_ns.lua | 18 ++++++++++-------- 4 files changed, 27 insertions(+), 21 deletions(-) diff --git a/classes/InvRef.lua b/classes/InvRef.lua index 96d82c7..69adb12 100644 --- a/classes/InvRef.lua +++ b/classes/InvRef.lua @@ -32,8 +32,8 @@ function InvRef:set_width(list_name, width) end function InvRef:get_stack(list_name, i) end --- copy stack to index i in list --- @param list_name string ---- @param i number ---- @param stack ItemStack +--- @param i number +--- @param stack ItemStack? function InvRef:set_stack(list_name, i, stack) end --- return full list --- @param list_name string diff --git a/classes/ObjectRef/Player.lua b/classes/ObjectRef/Player.lua index af7eb7d..60e0fe5 100644 --- a/classes/ObjectRef/Player.lua +++ b/classes/ObjectRef/Player.lua @@ -105,6 +105,8 @@ function Player:get_formspec_prepend(formspec) end --- * The fields `LMB` and `RMB` are equal to `dig` and `place` respectively, --- and exist only to preserve backwards compatibility. --- * Returns an empty table `{}` if the object is not a player. +--- +--- @return table function Player:get_player_control() end --- returns integer with bit packed player pressed --- keys. @@ -217,9 +219,9 @@ function Player:set_minimap_modes(modes_list, selected_mode) end --- * Passing no arguments resets the sky to its default values. --- * `sky_parameters` is a table with the following optional fields: --- * `base_color`: ColorSpec, changes fog in "skybox" and "plain". (default: `#ffffff`) ---- * `body_orbit_tilt`: Float, rotation angle of sun/moon orbit in degrees. ---- By default, orbit is controlled by a client-side setting, and this field is not set. ---- After a value is assigned, it can only be changed to another float value. +--- * `body_orbit_tilt`: Float, rotation angle of sun/moon orbit in degrees. +--- By default, orbit is controlled by a client-side setting, and this field is not set. +--- After a value is assigned, it can only be changed to another float value. --- Valid range [-60.0,60.0] (default: not set) --- * `type`: Available types: --- * `"regular"`: Uses 0 textures, `base_color` ignored @@ -262,15 +264,15 @@ function Player:set_minimap_modes(modes_list, selected_mode) end --- `"default"` uses the classic Minetest sun and moon tinting. --- Will use tonemaps, if set to `"default"`. (default: `"default"`) --- * `fog`: A table containing the following values: ---- * `fog_distance`: integer, set an upper bound for the client's viewing_range. ---- Any value >= 0 sets the desired upper bound for viewing_range, disables range_all and prevents disabling fog (F3 key by default). +--- * `fog_distance`: integer, set an upper bound for the client's viewing_range. +--- Any value >= 0 sets the desired upper bound for viewing_range, disables range_all and prevents disabling fog (F3 key by default). --- Any value < 0 resets the behavior to being client-controlled. (default: -1) ---- * `fog_start`: float, override the client's fog_start. ---- Fraction of the visible distance at which fog starts to be rendered. +--- * `fog_start`: float, override the client's fog_start. +--- Fraction of the visible distance at which fog starts to be rendered. --- Any value between [0.0, 0.99] set the fog_start as a fraction of the viewing_range. --- Any value < 0, resets the behavior to being client-controlled. (default: -1) ---- * `fog_color`: ColorSpec, override the color of the fog. ---- Unlike `base_color` above this will apply regardless of the skybox type. +--- * `fog_color`: ColorSpec, override the color of the fog. +--- Unlike `base_color` above this will apply regardless of the skybox type. --- (default: `"#00000000"`, which means no override) --- @param sky_parameters table function Player:set_sky(sky_parameters) end diff --git a/definitions/HUDDefinition.lua b/definitions/HUDDefinition.lua index cbd0017..9dfb6b5 100644 --- a/definitions/HUDDefinition.lua +++ b/definitions/HUDDefinition.lua @@ -4,7 +4,7 @@ local HudDefinition = { --- --- The `name` field is not yet used, but should contain a description of what the HUD element represents. --- - --- @type string + --- @type string? name = "", --- HUD element type, one of: @@ -18,11 +18,13 @@ local HudDefinition = { --- the position is instead determined by world_pos, the world position of the waypoint. --- * `"compass"` - Displays an image oriented or translated according to current heading direction. --- * `"minimap"` - Displays a minimap on the HUD. + --- + --- @type string? type = "image", --- HUD element type: "image", "text", "statbar", "inventory", "waypoint", "image_waypoint". --- In case both are specified (`type` and `hud_elem_type`) `type` will be used. --- @deprecated - --- @type string + --- @type string? hud_elem_type = "", --- Position on the screen, range: `{x = 0..1, y = 0..1}`. diff --git a/minetest_ns.lua b/minetest_ns.lua index 14bc372..d40abf2 100644 --- a/minetest_ns.lua +++ b/minetest_ns.lua @@ -2089,6 +2089,8 @@ function minetest.write_json(data, styled) end --- * Example: `serialize({foo='bar'})`, returns `'return { ["foo"] = "bar" }'` --- --- [View in lua_api.txt](https://github.com/minetest/minetest/blob/5.4.1/doc/lua_api.txt#L5686-L5689) +--- @param table +--- @return string function minetest.serialize(table) end --- Returns a table --- * Convert a string returned by `minetest.serialize` into a table @@ -2388,17 +2390,17 @@ minetest.registered_privileges = {} -- Built-in libraries and extensions -- ----@generic T : table ----@param value `T` ----@return `T` +--- @generic T : table +--- @param value T +--- @return T function table.copy(value) end --- @param list table --- @param value any function table.indexof(list, value) end ----@param obj any ----@param dumped table ----@return string +--- @param obj any +--- @param dumped table +--- @return string function dump(obj, dumped) end -- @@ -2415,6 +2417,6 @@ invisibility = nil --- https://luajit.org/ext_jit.html jit = {} --- Legacy function, should be removed after upgrading to 5.5 ----@deprecated +--- Legacy function, should be removed after upgrading to 5.5 +--- @deprecated function spawn_falling_node(pos, nodename) end