1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-06-27 16:36:03 +00:00

Add table.copy_with_metatables (#15754)

This commit is contained in:
Lars Müller 2025-03-14 11:52:42 +01:00 committed by GitHub
parent 8717c7bd00
commit 077828d0d9
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 63 additions and 10 deletions

View file

@ -4142,6 +4142,11 @@ Helper functions
* returns time with microsecond precision. May not return wall time.
* `table.copy(table)`: returns a table
* returns a deep copy of `table`
* strips metatables, but this may change in the future
* `table.copy_with_metatables(table)`
* since 5.12
* `table` can also be non-table value, which will be returned as-is
* preserves metatables as they are
* `table.indexof(list, val)`: returns the smallest numerical index containing
the value `val` in the table `list`. Non-numerical indices are ignored.
If `val` could not be found, `-1` is returned. `list` must not have