mirror of
https://github.com/luanti-org/luanti.git
synced 2025-08-26 18:21:04 +00:00
add an 'equals' method to ItemStack and compatibility w/ lua '==' (#12771)
Co-authored-by: rubenwardy <rw@rubenwardy.com> Co-authored-by: sfan5 <sfan5@live.de>
This commit is contained in:
parent
b2a3f53b29
commit
440d966b93
5 changed files with 130 additions and 1 deletions
|
@ -6811,6 +6811,23 @@ an itemstring, a table or `nil`.
|
|||
* `peek_item(n)`: returns taken `ItemStack`
|
||||
* Copy (don't remove) up to `n` items from this stack
|
||||
* `n`: number, default: `1`
|
||||
* `equals(other)`:
|
||||
* returns `true` if this stack is identical to `other`.
|
||||
* Note: `stack1:to_string() == stack2:to_string()` is not reliable,
|
||||
as stack metadata can be serialized in arbitrary order.
|
||||
* Note: if `other` is an itemstring or table representation of an
|
||||
ItemStack, this will always return false, even if it is
|
||||
"equivalent".
|
||||
|
||||
### Operators
|
||||
|
||||
* `stack1 == stack2`:
|
||||
* Returns whether `stack1` and `stack2` are identical.
|
||||
* Note: `stack1:to_string() == stack2:to_string()` is not reliable,
|
||||
as stack metadata can be serialized in arbitrary order.
|
||||
* Note: if `stack2` is an itemstring or table representation of an
|
||||
ItemStack, this will always return false, even if it is
|
||||
"equivalent".
|
||||
|
||||
`ItemStackMetaRef`
|
||||
------------------
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue