Skip to content
Permalink
Browse files

lua_api.txt: Document how to properly clear node metadata

  • Loading branch information
mtango688 authored and paramat committed Jul 28, 2016
1 parent cc01c3c commit 573b50ab2c964466c67739406c7eae0dd302b106
Showing with 1 addition and 0 deletions.
  1. +1 −0 doc/lua_api.txt
@@ -2641,6 +2641,7 @@ Can be gotten via `minetest.get_meta(pos)`.
* `get_inventory()`: returns `InvRef`
* `to_table()`: returns `nil` or `{fields = {...}, inventory = {list1 = {}, ...}}`
* `from_table(nil or {})`
* to clear metadata, use from_table(nil)
* See "Node Metadata"

### `NodeTimerRef`

3 comments on commit 573b50a

@HybridDog

This comment has been minimized.

Copy link
Contributor

@HybridDog HybridDog replied Aug 1, 2016

@mtango688 in my experience meta:to_table() never returns nil
What is the meaning of clear metadata?

@mtango688

This comment has been minimized.

Copy link
Contributor

@mtango688 mtango688 replied Aug 1, 2016

Do you know what a node is?

In Minetest, you obtain a reference to a node, and then you can perform several methods, one of which is "get_meta(pos)". From that, you can obtain a reference to extra data and functionality (called NodeMetaData). The above commit simply documents how to reset that data.

@HybridDog

This comment has been minimized.

Copy link
Contributor

@HybridDog HybridDog replied Aug 1, 2016

If you reset the metadata and then get the table using to_table(), it's not nil but {fields={}, inventory={}}, so l updated the WorldEdit save function.
HybridDog/WorldEdit-pack@46518c3#diff-47530146b5061f78ea9bf09cf9e200a3R163
In which case does to_table() return nil?
And does from_table{} also reset it?

Please sign in to comment.
You can’t perform that action at this time.