From: est31 Date: Mon, 23 Mar 2015 01:38:53 +0000 (+0100) Subject: Fix minetest.get_craft_recipe function X-Git-Tag: 0.4.13~445 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=5b5c4980112843e38d11cbc5c59d7c5de48da980;p=oweals%2Fminetest.git Fix minetest.get_craft_recipe function Previously, calling it resulted in a crash. --- diff --git a/src/script/lua_api/l_craft.cpp b/src/script/lua_api/l_craft.cpp index 40342871d..b321fb32f 100644 --- a/src/script/lua_api/l_craft.cpp +++ b/src/script/lua_api/l_craft.cpp @@ -393,6 +393,8 @@ int ModApiCraft::l_get_craft_recipe(lua_State *L) std::vector recipes = server->cdef() ->getCraftRecipes(output, server, 1); + lua_createtable(L, 1, 0); + if (recipes.empty()) { lua_pushnil(L); lua_setfield(L, -2, "items");