mirror of
https://github.com/BlackMATov/evolved.lua.git
synced 2025-12-13 03:29:08 +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.
|
||||
|
||||
```lua
|
||||
---@param index integer
|
||||
---@param version integer
|
||||
---@param primary integer
|
||||
---@param secondary integer
|
||||
---@return evolved.id id
|
||||
---@nodiscard
|
||||
function evolved.pack(index, version) end
|
||||
function evolved.pack(primary, secondary) end
|
||||
|
||||
---@param id evolved.id
|
||||
---@return integer primary
|
||||
@@ -1409,11 +1409,11 @@ function evolved.name(...) end
|
||||
### `evolved.pack`
|
||||
|
||||
```lua
|
||||
---@param index integer
|
||||
---@param version integer
|
||||
---@param primary integer
|
||||
---@param secondary integer
|
||||
---@return evolved.id id
|
||||
---@nodiscard
|
||||
function evolved.pack(index, version) end
|
||||
function evolved.pack(primary, secondary) end
|
||||
```
|
||||
|
||||
### `evolved.unpack`
|
||||
|
||||
16
evolved.lua
16
evolved.lua
@@ -4789,20 +4789,20 @@ function __evolved_name(...)
|
||||
end
|
||||
end
|
||||
|
||||
---@param index integer
|
||||
---@param version integer
|
||||
---@param primary integer
|
||||
---@param secondary integer
|
||||
---@return evolved.id id
|
||||
---@nodiscard
|
||||
function __evolved_pack(index, version)
|
||||
if index < 1 or index > 2 ^ 20 - 1 then
|
||||
__error_fmt('the index (%d) is out of range [1, 2 ^ 20 - 1]', index)
|
||||
function __evolved_pack(primary, secondary)
|
||||
if primary < 1 or primary > 2 ^ 20 - 1 then
|
||||
__error_fmt('the primary (%d) is out of range [1, 2 ^ 20 - 1]', primary)
|
||||
end
|
||||
|
||||
if version < 1 or version > 2 ^ 20 - 1 then
|
||||
__error_fmt('the version (%d) is out of range [1, 2 ^ 20 - 1]', version)
|
||||
if secondary < 1 or secondary > 2 ^ 20 - 1 then
|
||||
__error_fmt('the secondary (%d) is out of range [1, 2 ^ 20 - 1]', secondary)
|
||||
end
|
||||
|
||||
return index + version * 2 ^ 20 --[[@as evolved.id]]
|
||||
return primary + secondary * 2 ^ 20 --[[@as evolved.id]]
|
||||
end
|
||||
|
||||
---@param id evolved.id
|
||||
|
||||
Reference in New Issue
Block a user