Skip to content

Implement ItemStack:{get,set}_metadata #81

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions itemstack.lua
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,14 @@ end
--* `get_meta()`: returns ItemStackMetaRef. See section for more details
function ItemStack:get_meta() return self._meta end
--* `get_metadata()`: (DEPRECATED) Returns metadata (a string attached to an item stack).
function ItemStack:get_metadata() DEPRECATED("Using deprecated ItemStack:get_metadata()") end
function ItemStack:get_metadata()
return self._meta:get_string("")
end
--* `set_metadata(metadata)`: (DEPRECATED) Returns true.
function ItemStack:set_metadata(metadata) DEPRECATED("Using deprecated ItemStack:set_metadata(metadata)") end
function ItemStack:set_metadata(metadata)
self._meta:set_string("", metadata)
return true
end
--* `get_description()`: returns the description shown in inventory list tooltips.
-- The engine uses the same as this function for item descriptions.
-- Fields for finding the description, in order:
Expand Down