mirror of
https://github.com/BlackMATov/evolved.lua.git
synced 2025-12-13 11:38:15 +07:00
style fixes
This commit is contained in:
12
README.md
12
README.md
@@ -154,11 +154,11 @@ function evolved.alive_any(...) end
|
|||||||
Sometimes (for debugging purposes, for example), it is necessary to extract the index and version from an identifier or to pack them back into an identifier. The [`evolved.pack`](#evolvedpack) and [`evolved.unpack`](#evolvedunpack) functions can be used for this purpose.
|
Sometimes (for debugging purposes, for example), it is necessary to extract the index and version from an identifier or to pack them back into an identifier. The [`evolved.pack`](#evolvedpack) and [`evolved.unpack`](#evolvedunpack) functions can be used for this purpose.
|
||||||
|
|
||||||
```lua
|
```lua
|
||||||
---@param index integer
|
---@param primary integer
|
||||||
---@param version integer
|
---@param secondary integer
|
||||||
---@return evolved.id id
|
---@return evolved.id id
|
||||||
---@nodiscard
|
---@nodiscard
|
||||||
function evolved.pack(index, version) end
|
function evolved.pack(primary, secondary) end
|
||||||
|
|
||||||
---@param id evolved.id
|
---@param id evolved.id
|
||||||
---@return integer primary
|
---@return integer primary
|
||||||
@@ -1409,11 +1409,11 @@ function evolved.name(...) end
|
|||||||
### `evolved.pack`
|
### `evolved.pack`
|
||||||
|
|
||||||
```lua
|
```lua
|
||||||
---@param index integer
|
---@param primary integer
|
||||||
---@param version integer
|
---@param secondary integer
|
||||||
---@return evolved.id id
|
---@return evolved.id id
|
||||||
---@nodiscard
|
---@nodiscard
|
||||||
function evolved.pack(index, version) end
|
function evolved.pack(primary, secondary) end
|
||||||
```
|
```
|
||||||
|
|
||||||
### `evolved.unpack`
|
### `evolved.unpack`
|
||||||
|
|||||||
16
evolved.lua
16
evolved.lua
@@ -4789,20 +4789,20 @@ function __evolved_name(...)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
---@param index integer
|
---@param primary integer
|
||||||
---@param version integer
|
---@param secondary integer
|
||||||
---@return evolved.id id
|
---@return evolved.id id
|
||||||
---@nodiscard
|
---@nodiscard
|
||||||
function __evolved_pack(index, version)
|
function __evolved_pack(primary, secondary)
|
||||||
if index < 1 or index > 2 ^ 20 - 1 then
|
if primary < 1 or primary > 2 ^ 20 - 1 then
|
||||||
__error_fmt('the index (%d) is out of range [1, 2 ^ 20 - 1]', index)
|
__error_fmt('the primary (%d) is out of range [1, 2 ^ 20 - 1]', primary)
|
||||||
end
|
end
|
||||||
|
|
||||||
if version < 1 or version > 2 ^ 20 - 1 then
|
if secondary < 1 or secondary > 2 ^ 20 - 1 then
|
||||||
__error_fmt('the version (%d) is out of range [1, 2 ^ 20 - 1]', version)
|
__error_fmt('the secondary (%d) is out of range [1, 2 ^ 20 - 1]', secondary)
|
||||||
end
|
end
|
||||||
|
|
||||||
return index + version * 2 ^ 20 --[[@as evolved.id]]
|
return primary + secondary * 2 ^ 20 --[[@as evolved.id]]
|
||||||
end
|
end
|
||||||
|
|
||||||
---@param id evolved.id
|
---@param id evolved.id
|
||||||
|
|||||||
Reference in New Issue
Block a user