end
minetest.show_formspec(player_name, "default:book", formspec)
+ return itemstack
end
minetest.register_on_player_receive_fields(function(player, formname, fields)
end
end
- local data_str = minetest.serialize(data)
- stack:set_metadata(data_str)
- book_on_use(stack, player)
+ stack:get_meta():from_table(data)
+ stack = book_on_use(stack, player)
end
+ -- Update stack
player:set_wielded_item(stack)
end)
if not original then
return
end
- local copymeta = original:get_metadata()
+ local copymeta = original:get_meta():to_table()
-- copy of the book held by player's mouse cursor
- itemstack:set_metadata(copymeta)
+ itemstack:get_meta():from_table(copymeta)
-- put the book with metadata back in the craft grid
craft_inv:set_stack("craft", index, original)
end)