diff options
author | est31 <MTest31@outlook.com> | 2015-03-23 02:38:53 +0100 |
---|---|---|
committer | Craig Robbins <kde.psych@gmail.com> | 2015-03-23 13:40:20 +1000 |
commit | 5b5c4980112843e38d11cbc5c59d7c5de48da980 (patch) | |
tree | 0959c6f222d6d498ddc20c8a93c81cbea4a8c391 /src | |
parent | 0ae75f2a4e3107271924311b93327ff4b6c24e8c (diff) | |
download | minetest-5b5c4980112843e38d11cbc5c59d7c5de48da980.tar.gz minetest-5b5c4980112843e38d11cbc5c59d7c5de48da980.tar.bz2 minetest-5b5c4980112843e38d11cbc5c59d7c5de48da980.zip |
Fix minetest.get_craft_recipe function
Previously, calling it resulted in a crash.
Diffstat (limited to 'src')
-rw-r--r-- | src/script/lua_api/l_craft.cpp | 2 |
1 files changed, 2 insertions, 0 deletions
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<CraftDefinition*> recipes = server->cdef() ->getCraftRecipes(output, server, 1); + lua_createtable(L, 1, 0); + if (recipes.empty()) { lua_pushnil(L); lua_setfield(L, -2, "items"); |