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
ItemStacks can also have a single field of metadata attached to
them.
ItemStacks can have meta data, and use the same API as [Node Metadata](node_metadata.html).
{% highlight lua %}
local meta = items:get_metadata()
print(dump(meta))
meta = meta .. " ha!"
items:set_metadata(meta)
local meta = items:get_meta()
meta:set_string("foo", meta:get_string("foo") .. " ha!")
print(dump(meta:get_string("foo")))
-- if ran multiple times, would give " ha! ha! ha!"
{% endhighlight %}