Item Stacks: Add note about item meta data

This commit is contained in:
rubenwardy 2018-03-29 17:14:14 +01:00
parent 6f9af6f0fd
commit 4b23c1689a

View File

@ -120,14 +120,13 @@ local items2 = ItemStack(data)
## Meta data ## Meta data
ItemStacks can also have a single field of metadata attached to ItemStacks can have meta data, and use the same API as [Node Metadata](node_metadata.html).
them.
{% highlight lua %} {% highlight lua %}
local meta = items:get_metadata() local meta = items:get_meta()
print(dump(meta)) meta:set_string("foo", meta:get_string("foo") .. " ha!")
meta = meta .. " ha!"
items:set_metadata(meta) print(dump(meta:get_string("foo")))
-- if ran multiple times, would give " ha! ha! ha!" -- if ran multiple times, would give " ha! ha! ha!"
{% endhighlight %} {% endhighlight %}