Difference between revisions of "minetest.get craft result"
Jump to navigation
Jump to search
OWNSyouAll (talk | contribs) (Added a note about the example code running before the recipes are registered.) |
ROllerozxa (talk | contribs) |
||
(3 intermediate revisions by 3 users not shown) | |||
Line 1: | Line 1: | ||
+ | {{UnofficialLua}} | ||
{{DISPLAYTITLE:minetest.get_craft_result}} | {{DISPLAYTITLE:minetest.get_craft_result}} | ||
− | + | See [https://minetest.gitlab.io/minetest/minetest-namespace-reference/ minetest.get_craft_result] in the Lua API documentation. | |
− | |||
− | == | + | == Example == |
− | + | (will only work if the mod is loaded after "default" registers crafting recipes) | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
<source> | <source> | ||
output, decremented_input = minetest.get_craft_result({ method = "normal", width = 1, items = { ItemStack("default:coal_lump 2"), ItemStack("default:stick 2") }}) | output, decremented_input = minetest.get_craft_result({ method = "normal", width = 1, items = { ItemStack("default:coal_lump 2"), ItemStack("default:stick 2") }}) | ||
Line 29: | Line 17: | ||
</source> | </source> | ||
− | + | [[Category:Methods|g]] | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | [[Category:Methods]] |
Latest revision as of 14:03, 25 October 2022
This page contains unofficial, low-quality Lua API documentation and is likely to be outdated or wrong. Do not rely on it! For the official and up-to-date documentation, see Lua API Documentation. |
This page has been proposed for deletion for the following reason: "Contains unofficial and potentially outdated, redundant and inconsistent Lua API information" If you don't think that this page should be deleted, please explain why on the talk page. |
See minetest.get_craft_result in the Lua API documentation.
Example
(will only work if the mod is loaded after "default" registers crafting recipes)
output, decremented_input = minetest.get_craft_result({ method = "normal", width = 1, items = { ItemStack("default:coal_lump 2"), ItemStack("default:stick 2") }})
-- output.item:to_table() = {wear = 0, name = "default:torch", count = 4, metadata = ""}
-- output.time = 0
-- decremented_input.method = "normal"
-- decremented_input.width = 1
-- #decremented_input.items = 2
-- decremented_input.items[1]:to_table() = {wear = 0, name = "default:coal_lump", count = 1, metadata = ""}
-- decremented_input.items[2]:to_table() = {wear = 0, name = "default:stick", count = 1, metadata = ""}