Skip to content
Permalink
Browse files
Add pauloue's ItemStack example to docs (#9853)
  • Loading branch information
FreeLikeGNU committed Dec 10, 2021
1 parent d9d2193 commit a8c58d5cbba994849ea78e3eecefbefb70070bb7
Showing with 15 additions and 0 deletions.
  1. +15 −0 doc/lua_api.txt
@@ -2181,6 +2181,21 @@ Example:
meta:set_string("key", "value")
print(dump(meta:to_table()))

Example manipulations of "description" and expected output behaviors:

print(ItemStack("default:pick_steel"):get_description()) --> Steel Pickaxe
print(ItemStack("foobar"):get_description()) --> Unknown Item

local stack = ItemStack("default:stone")
stack:get_meta():set_string("description", "Custom description\nAnother line")
print(stack:get_description()) --> Custom description\nAnother line
print(stack:get_short_description()) --> Custom description

stack:get_meta():set_string("short_description", "Short")
print(stack:get_description()) --> Custom description\nAnother line
print(stack:get_short_description()) --> Short

print(ItemStack("mod:item_with_no_desc"):get_description()) --> mod:item_with_no_desc



0 comments on commit a8c58d5

Please sign in to comment.