ide-helper: improve docs for escape sequences functions & pos-sring concertion functions.

This commit is contained in:
alek13
2025-04-24 17:16:43 +03:00
parent 306b0caffe
commit c860ceee0f

View File

@@ -66,6 +66,7 @@ minetest = {}
--- * The escape sequence sets the text color to `color` --- * The escape sequence sets the text color to `color`
--- ---
--- [View in lua_api.txt](https://github.com/minetest/minetest/blob/5.4.1/doc/lua_api.txt#L3107-L3109) --- [View in lua_api.txt](https://github.com/minetest/minetest/blob/5.4.1/doc/lua_api.txt#L3107-L3109)
---
--- @param color string @ColorString --- @param color string @ColorString
--- @return string --- @return string
function minetest.get_color_escape_sequence(color) end function minetest.get_color_escape_sequence(color) end
@@ -75,6 +76,7 @@ function minetest.get_color_escape_sequence(color) end
--- minetest.get_color_escape_sequence("#ffffff")` --- minetest.get_color_escape_sequence("#ffffff")`
--- ---
--- [View in lua_api.txt](https://github.com/minetest/minetest/blob/5.4.1/doc/lua_api.txt#L3110-L3114) --- [View in lua_api.txt](https://github.com/minetest/minetest/blob/5.4.1/doc/lua_api.txt#L3110-L3114)
---
--- @param color string @ColorString --- @param color string @ColorString
--- @param message string --- @param message string
--- @return string --- @return string
@@ -84,18 +86,28 @@ function minetest.colorize(color, message) end
--- `color`. Only defined for item descriptions and tooltips. --- `color`. Only defined for item descriptions and tooltips.
--- ---
--- [View in lua_api.txt](https://github.com/minetest/minetest/blob/5.4.1/doc/lua_api.txt#L3115-L3118) --- [View in lua_api.txt](https://github.com/minetest/minetest/blob/5.4.1/doc/lua_api.txt#L3115-L3118)
---
--- @param color string @ColorString
--- @return string
function minetest.get_background_escape_sequence(color) end function minetest.get_background_escape_sequence(color) end
--- * Removes foreground colors added by `get_color_escape_sequence`. --- * Removes foreground colors added by `get_color_escape_sequence`.
--- ---
--- [View in lua_api.txt](https://github.com/minetest/minetest/blob/5.4.1/doc/lua_api.txt#L3119-L3120) --- [View in lua_api.txt](https://github.com/minetest/minetest/blob/5.4.1/doc/lua_api.txt#L3119-L3120)
--- @param str string
--- @return string
function minetest.strip_foreground_colors(str) end function minetest.strip_foreground_colors(str) end
--- * Removes background colors added by `get_background_escape_sequence`. --- * Removes background colors added by `get_background_escape_sequence`.
--- ---
--- [View in lua_api.txt](https://github.com/minetest/minetest/blob/5.4.1/doc/lua_api.txt#L3121-L3122) --- [View in lua_api.txt](https://github.com/minetest/minetest/blob/5.4.1/doc/lua_api.txt#L3121-L3122)
---
--- @param str string
function minetest.strip_background_colors(str) end function minetest.strip_background_colors(str) end
--- * Removes all color escape sequences. --- * Removes all color escape sequences.
--- ---
--- [View in lua_api.txt](https://github.com/minetest/minetest/blob/5.4.1/doc/lua_api.txt#L3123-L3124) --- [View in lua_api.txt](https://github.com/minetest/minetest/blob/5.4.1/doc/lua_api.txt#L3123-L3124)
---
--- @param str string
--- @return string
function minetest.strip_colors(str) end function minetest.strip_colors(str) end
-- Helpers: -- Helpers:
@@ -110,6 +122,11 @@ function minetest.strip_colors(str) end
--- is returned, default: `false` --- is returned, default: `false`
--- ---
--- [View in lua_api.txt](https://github.com/minetest/minetest/blob/5.4.1/doc/lua_api.txt#L3244-L3251) --- [View in lua_api.txt](https://github.com/minetest/minetest/blob/5.4.1/doc/lua_api.txt#L3244-L3251)
---
--- @param str string
--- @param limit number
--- @param as_table boolean
--- @return string|table
function minetest.wrap_text(str, limit, as_table) end function minetest.wrap_text(str, limit, as_table) end
--- returns string `"(X,Y,Z)"` --- returns string `"(X,Y,Z)"`
--- * `pos`: table {x=X, y=Y, z=Z} --- * `pos`: table {x=X, y=Y, z=Z}
@@ -118,12 +135,19 @@ function minetest.wrap_text(str, limit, as_table) end
--- the position are rounded to the given decimal place. --- the position are rounded to the given decimal place.
--- ---
--- [View in lua_api.txt](https://github.com/minetest/minetest/blob/5.4.1/doc/lua_api.txt#L3252-L3256) --- [View in lua_api.txt](https://github.com/minetest/minetest/blob/5.4.1/doc/lua_api.txt#L3252-L3256)
---
--- @param pos Position
--- @param decimal_places number
--- @return string
function minetest.pos_to_string(pos, decimal_places) end function minetest.pos_to_string(pos, decimal_places) end
--- returns a position or `nil` --- returns a position or `nil`
--- * Same but in reverse. --- * Same but in reverse.
--- * If the string can't be parsed to a position, nothing is returned. --- * If the string can't be parsed to a position, nothing is returned.
--- ---
--- [View in lua_api.txt](https://github.com/minetest/minetest/blob/5.4.1/doc/lua_api.txt#L3257-L3259) --- [View in lua_api.txt](https://github.com/minetest/minetest/blob/5.4.1/doc/lua_api.txt#L3257-L3259)
---
--- @param string string
--- @return Position
function minetest.string_to_pos(string) end function minetest.string_to_pos(string) end
--- returns two positions --- returns two positions
--- * Converts a string representing an area box into two positions --- * Converts a string representing an area box into two positions