minetest_docs
minetest_docs copied to clipboard
Document ItemStack returning functions
on_use etc. Include a note that prevents people from making the common mistake of trying to modify the inventory before/instead of returning the itemstack they want to be set.
The confusion here is likely to stem from the fact that ItemStack is a mutable reference type, yet all functions & callbacks using ItemStacks pass them "by value", copying them (constrast this with e.g. vectors which are mutable but only provide methods that return copies, thus making it apparent that you have to feed the vector back in using some setter). I wonder whether such a note would suit the ItemStack doc well?