From 5a0e8e35d3d0aa9bcfae167a75bf0cefeca90483 Mon Sep 17 00:00:00 2001 From: jp Date: Mon, 7 Dec 2015 23:26:08 +0100 Subject: [PATCH] Be sure it can't be nil --- worktable.lua | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/worktable.lua b/worktable.lua index 6b249d1..9e1239b 100644 --- a/worktable.lua +++ b/worktable.lua @@ -38,7 +38,7 @@ function worktable.craft_output_recipe(pos, start_i, pagenum, stackname) local meta = minetest.get_meta(pos) local inv = meta:get_inventory() local floor = math.floor - pagenum = floor(pagenum) + pagenum = floor(pagenum) or 0 local inventory_size = meta:get_int("inventory_size") local recipe_num = meta:get_int("recipe_num") local filter = meta:get_string("filter") or "" @@ -62,10 +62,10 @@ function worktable.craft_output_recipe(pos, start_i, pagenum, stackname) "field[1.8,0.32;2.6,1;filter;;"..filter.."]" if stackname then - local stack_width = minetest.get_all_craft_recipes(stackname)[recipe_num]["width"] - local stack_items = minetest.get_all_craft_recipes(stackname)[recipe_num]["items"] - local stack_type = minetest.get_all_craft_recipes(stackname)[recipe_num]["type"] - local stack_output = minetest.get_all_craft_recipes(stackname)[recipe_num]["output"] + local stack_width = minetest.get_all_craft_recipes(stackname)[recipe_num].width + local stack_items = minetest.get_all_craft_recipes(stackname)[recipe_num].items + local stack_type = minetest.get_all_craft_recipes(stackname)[recipe_num].type + local stack_output = minetest.get_all_craft_recipes(stackname)[recipe_num].output local stack_count = stack_output:match("%s(%d+)") local items_num = #minetest.get_all_craft_recipes(stackname)