@@ -294,11 +294,14 @@ int ModApiCraft::l_clear_craft(lua_State *L)
294
294
std::string type = getstringfield_default (L, table, " type" , " shaped" );
295
295
CraftOutput c_output (output, 0 );
296
296
if (!output.empty ()) {
297
- if (craftdef->clearCraftRecipesByOutput (c_output, getServer (L)))
298
- return 0 ;
297
+ if (craftdef->clearCraftRecipesByOutput (c_output, getServer (L))) {
298
+ lua_pushboolean (L, true );
299
+ return 1 ;
300
+ }
299
301
300
- throw LuaError (" No craft recipe known for output"
301
- " (output=\" " + output + " \" )" );
302
+ warningstream << " No craft recipe known for output" << std::endl;
303
+ lua_pushboolean (L, false );
304
+ return 1 ;
302
305
}
303
306
std::vector<std::string> recipe;
304
307
int width = 0 ;
@@ -347,10 +350,15 @@ int ModApiCraft::l_clear_craft(lua_State *L)
347
350
} else {
348
351
throw LuaError (" Unknown crafting definition type: \" " + type + " \" " );
349
352
}
350
- if (!craftdef->clearCraftRecipesByInput (method, width, recipe, getServer (L)))
351
- throw LuaError (" No crafting specified for input" );
352
- lua_pop (L, 1 );
353
- return 0 ;
353
+
354
+ if (!craftdef->clearCraftRecipesByInput (method, width, recipe, getServer (L))) {
355
+ warningstream << " No craft recipe matches input" << std::endl;
356
+ lua_pushboolean (L, false );
357
+ return 1 ;
358
+ }
359
+
360
+ lua_pushboolean (L, true );
361
+ return 1 ;
354
362
}
355
363
356
364
// get_craft_result(input)
0 commit comments