Fix minetest.get_craft_recipe function
authorest31 <MTest31@outlook.com>
Mon, 23 Mar 2015 01:38:53 +0000 (02:38 +0100)
committerCraig Robbins <kde.psych@gmail.com>
Mon, 23 Mar 2015 03:40:20 +0000 (13:40 +1000)
Previously, calling it resulted in a crash.

src/script/lua_api/l_craft.cpp

index 40342871dc76e08e26319e760c81f16875a7e276..b321fb32f77daed8d271a1d6a3116ab38b737cf8 100644 (file)
@@ -393,6 +393,8 @@ int ModApiCraft::l_get_craft_recipe(lua_State *L)
        std::vector<CraftDefinition*> recipes = server->cdef()
                        ->getCraftRecipes(output, server, 1);
 
+       lua_createtable(L, 1, 0);
+
        if (recipes.empty()) {
                lua_pushnil(L);
                lua_setfield(L, -2, "items");