EmmyLua -> LuaLS

This commit is contained in:
Van
2026-06-16 17:50:09 +03:00
parent 5272c8e5a8
commit 24531f8af6
5 changed files with 64 additions and 40 deletions

View File

@@ -1,50 +1,73 @@
--- @meta ---@meta
---Base class used by [`StorageRef`], [`NodeMetaRef`], [`ItemStackMetaRef`],
--- Base class used by [`StorageRef`], [`NodeMetaRef`], [`ItemStackMetaRef`], ---and [`PlayerMetaRef`].
--- and [`PlayerMetaRef`].
--- ---
--- Note: If a metadata value is in the format `${k}`, an attempt to get the value ---Note: If a metadata value is in the format `${k}`, an attempt to get the value
--- will return the value associated with key `k`. There is a low recursion limit. ---will return the value associated with key `k`. There is a low recursion limit.
--- This behavior is **deprecated** and will be removed in a future version. Usage ---This behavior is **deprecated** and will be removed in a future version. Usage
--- of the `${k}` syntax in formspecs is not deprecated. ---of the `${k}` syntax in formspecs is not deprecated.
--- ---
--- @class MetaDataRef ---@class MetaDataRef
MetaDataRef = {} MetaDataRef = {}
---@param key string ---Returns `true` if `key` present, otherwise `false`.
---@return boolean|nil ---
---Returns `nil` when the MetaData is inexistent.
---@param key string
---@return boolean?
function MetaDataRef:contains(key) end function MetaDataRef:contains(key) end
---@param key string ---Returns the value stored at `key` as a string if present.
---@return string|nil ---
---Returns nil otherwise.
---@param key string
---@return string?
function MetaDataRef:get(key) end function MetaDataRef:get(key) end
---@param key string ---Set the string `value` at `key`.
---@param value string value "" will delete the key ---
---@return string ---Value of `""` will delete the key.
---@param key string
---@param value string
function MetaDataRef:set_string(key, value) end function MetaDataRef:set_string(key, value) end
---@param key string ---Returns a string value at `key` or `""` if not present.
---@return string ---@param key string
---@return string
function MetaDataRef:get_string(key) end function MetaDataRef:get_string(key) end
---@param key string ---Set an integer number `value` to `key`.
---@param value number ---
---@return number ---Range: [s32].
---
---Some systems internally have a larger value range
---but but you should not rely on this behavior to ensure portability of your code.
---
---The value will be converted into a string when stored.
---@param key string
---@param value integer
function MetaDataRef:set_int(key, value) end function MetaDataRef:set_int(key, value) end
---@param key string ---Returns the value stored at `key` as an integer.
---@return number Returns `0` if `key` not present. ---
---Returns `0` if key not present.
---@param key string
---@return integer
function MetaDataRef:get_int(key) end function MetaDataRef:get_int(key) end
---@param key string ---Store a number (a 64-bit floating-point number) exactly.
---@param value number ---
---@return number ---The value will be converted into a string when stored.
---@param key string
---@param value number
function MetaDataRef:set_float(key, value) end function MetaDataRef:set_float(key, value) end
---@param key string ---Returns a 64-bit floating-point number stored at `key`.
---@return number ---
---Returns `0` if key not present.
---@param key string
---@return number
function MetaDataRef:get_float(key) end function MetaDataRef:get_float(key) end
--- Returns a list of all keys in the metadata. --- Returns a list of all keys in the metadata.

View File

@@ -94,9 +94,9 @@ function VoxelManip:set_param2_data(param2_data) end
--- @overload fun(p1:MapPosition, p2:MapPosition) --- @overload fun(p1:MapPosition, p2:MapPosition)
--- @overload fun(propagate_shadow:boolean) --- @overload fun(propagate_shadow:boolean)
--- @overload fun() --- @overload fun()
--- @param p1 MapPosition --- @param p1 MapPosition?
--- @param p2 MapPosition --- @param p2 MapPosition?
--- @param propagate_shadow boolean --- @param propagate_shadow boolean?
function VoxelManip:calc_lighting(p1, p2, propagate_shadow) end function VoxelManip:calc_lighting(p1, p2, propagate_shadow) end
--- Update liquid flow --- Update liquid flow

View File

@@ -279,7 +279,7 @@ function core.get_translator(text_domain) end
--- not have localization enabled. However, if we have for instance a translation --- not have localization enabled. However, if we have for instance a translation
--- file named `wool.fr.tr` containing the following: --- file named `wool.fr.tr` containing the following:
--- ---
--- @1 Wool=Laine @1 --- \@1 Wool=Laine @1
--- Red=Rouge --- Red=Rouge
--- ---
--- this will be displayed as "Laine Rouge" on clients with a French locale. --- this will be displayed as "Laine Rouge" on clients with a French locale.
@@ -578,7 +578,7 @@ function core.register_allow_player_inventory_action(callback) end
--- * Does not accept or handle any return value. --- * Does not accept or handle any return value.
--- ---
--- [View in lua_api.txt](https://github.com/minetest/minetest/blob/5.4.1/doc/lua_api.txt#L4732-L4735) --- [View in lua_api.txt](https://github.com/minetest/minetest/blob/5.4.1/doc/lua_api.txt#L4732-L4735)
--- @param callback fun(player:ObjectRef|Player, action:"move"|"put"|"take", inventory:InvRef, inventory_info:table):integer? --- @param callback fun(player:Player, action:"move"|"put"|"take", inventory:InvRef, inventory_info:table):integer?
function core.register_on_player_inventory_action(callback) end function core.register_on_player_inventory_action(callback) end
--- * Called by `builtin` and mods when a player violates protection at a --- * Called by `builtin` and mods when a player violates protection at a
--- position (eg, digs a node or punches a protected entity). --- position (eg, digs a node or punches a protected entity).
@@ -2105,7 +2105,7 @@ function core.write_json(data, styled) end
--- * Example: `serialize({foo='bar'})`, returns `'return { ["foo"] = "bar" }'` --- * 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) --- [View in lua_api.txt](https://github.com/minetest/minetest/blob/5.4.1/doc/lua_api.txt#L5686-L5689)
--- @param table --- @param table table
--- @return string --- @return string
function core.serialize(table) end function core.serialize(table) end
--- Returns a table --- Returns a table

View File

@@ -622,23 +622,23 @@ local NodeDefinition = {
--- Called after the actual action has happened, according to what was --- Called after the actual action has happened, according to what was
--- allowed. --- allowed.
--- No return value. --- No return value.
--- @type (fun(pos:MapPosition, from_list:string, from_index:number, to_list:string, to_index:number, count:number, player:Player): void)? --- @type (fun(pos:MapPosition, from_list:string, from_index:number, to_list:string, to_index:number, count:number, player:Player): any)?
on_metadata_inventory_move = nil, on_metadata_inventory_move = nil,
--- Called after the actual action has happened, according to what was --- Called after the actual action has happened, according to what was
--- allowed. --- allowed.
--- No return value. --- No return value.
--- @type (fun(pos:MapPosition, listname:string, index:number, stack:ItemStack, player:Player): void)? --- @type (fun(pos:MapPosition, listname:string, index:number, stack:ItemStack, player:Player): any)?
on_metadata_inventory_put = nil, on_metadata_inventory_put = nil,
--- Called after the actual action has happened, according to what was --- Called after the actual action has happened, according to what was
--- allowed. --- allowed.
--- No return value. --- No return value.
--- @type (fun(pos:MapPosition, listname:string, index:number, stack:ItemStack, player:Player): void)? --- @type (fun(pos:MapPosition, listname:string, index:number, stack:ItemStack, player:Player): any)?
on_metadata_inventory_take = nil, on_metadata_inventory_take = nil,
--- intensity: 1.0 = mid range of regular TNT. --- intensity: 1.0 = mid range of regular TNT.
--- If defined, called when an explosion touches the node, instead of --- If defined, called when an explosion touches the node, instead of
--- removing the node. --- removing the node.
--- @type (fun(pos:MapPosition, intensity:number): void)? --- @type (fun(pos:MapPosition, intensity:number): any)?
on_blast = nil, on_blast = nil,
--- stores which mod actually registered a node --- stores which mod actually registered a node

View File

@@ -2,17 +2,18 @@
--- e.g. `"a,b":split(",")` returns `{"a","b"}` --- e.g. `"a,b":split(",")` returns `{"a","b"}`
--- @param s string
--- @param separator? string cannot be empty, default: `","` --- @param separator? string cannot be empty, default: `","`
--- @param include_empty? boolean default: `false` --- @param include_empty? boolean default: `false`
--- @param max_splits? number if it's negative, splits aren't limited, default: `-1` --- @param max_splits? number if it's negative, splits aren't limited, default: `-1`
--- @param sep_is_pattern? boolean it specifies whether separator is a plain string or a pattern (regex), default: `false` --- @param sep_is_pattern? boolean it specifies whether separator is a plain string or a pattern (regex), default: `false`
--- @return string[] --- @return string[]
function string:split(separator, include_empty, max_splits, sep_is_pattern) end function string.split(s, separator, include_empty, max_splits, sep_is_pattern) end
--- Returns the string without whitespace pre- and suffixes --- Returns the string without whitespace pre- and suffixes
--- e.g. `"\n \t\tfoo bar\t ":trim()` returns `"foo bar"` --- e.g. `"\n \t\tfoo bar\t ":trim()` returns `"foo bar"`
--- @return string --- @return string
function string:trim() end function string.trim() end
--- Backported from Lua 5.4, see https://www.lua.org/manual/5.4/manual.html#6.4.2 --- Backported from Lua 5.4, see https://www.lua.org/manual/5.4/manual.html#6.4.2
--- ---