From 10f3569b1cbcde5c8f8ed2ea2d5e5173d1bd99b9 Mon Sep 17 00:00:00 2001 From: Panquesito7 Date: Sun, 22 Mar 2020 13:32:58 -0600 Subject: [PATCH] Fix code warnings --- api.lua | 4 ++-- bags.lua | 3 +-- callbacks.lua | 2 -- internal.lua | 5 ++--- item_names.lua | 2 +- 5 files changed, 6 insertions(+), 10 deletions(-) diff --git a/api.lua b/api.lua index 071900d..d24135b 100644 --- a/api.lua +++ b/api.lua @@ -16,8 +16,8 @@ minetest.after(0.01, function() table.insert(unified_inventory.items_list, name) local all_names = rev_aliases[name] or {} table.insert(all_names, name) - for _, name in ipairs(all_names) do - local recipes = minetest.get_all_craft_recipes(name) + for _, player_name in ipairs(all_names) do + local recipes = minetest.get_all_craft_recipes(player_name) if recipes then for _, recipe in ipairs(recipes) do diff --git a/bags.lua b/bags.lua index a365139..c61c982 100644 --- a/bags.lua +++ b/bags.lua @@ -1,4 +1,4 @@ ---[[ +--[[ Bags for Minetest Copyright (c) 2012 cornernote, Brett O'Donnell @@ -166,7 +166,6 @@ local function load_bags_metadata(player, bags_inv) end minetest.register_on_joinplayer(function(player) - local player_inv = player:get_inventory() local player_name = player:get_player_name() local bags_inv = minetest.create_detached_inventory(player_name .. "_bags",{ on_put = function(inv, listname, index, stack, player) diff --git a/callbacks.lua b/callbacks.lua index 8bfe6b6..bc90237 100644 --- a/callbacks.lua +++ b/callbacks.lua @@ -28,7 +28,6 @@ minetest.register_on_joinplayer(function(player) -- Refill slot local refill = minetest.create_detached_inventory(player_name.."refill", { allow_put = function(inv, listname, index, stack, player) - local player_name = player:get_player_name() if unified_inventory.is_creative(player_name) then return stack:get_count() else @@ -36,7 +35,6 @@ minetest.register_on_joinplayer(function(player) end end, on_put = function(inv, listname, index, stack, player) - local player_name = player:get_player_name() local handle_refill = (minetest.registered_items[stack:get_name()] or {}).on_refill or default_refill stack = handle_refill(stack) inv:set_stack(listname, index, stack) diff --git a/internal.lua b/internal.lua index 05dc5f5..ee8b4a9 100644 --- a/internal.lua +++ b/internal.lua @@ -215,11 +215,10 @@ function unified_inventory.get_formspec(player, page) else local dir = unified_inventory.active_search_direction[player_name] local list_index = unified_inventory.current_index[player_name] - local page = math.floor(list_index / (ui_peruser.items_per_page) + 1) + local page2 = math.floor(list_index / (ui_peruser.items_per_page) + 1) local pagemax = math.floor( (#unified_inventory.filtered_items_list[player_name] - 1) / (ui_peruser.items_per_page) + 1) - local item = {} for y = 0, ui_peruser.pagerows - 1 do for x = 0, ui_peruser.pagecols - 1 do local name = unified_inventory.filtered_items_list[player_name][list_index] @@ -254,7 +253,7 @@ function unified_inventory.get_formspec(player, page) end end formspec[n] = "label[8.2,"..ui_peruser.form_header_y..";"..F(S("Page")) .. ": " - .. S("@1 of @2",page,pagemax).."]" + .. S("@1 of @2",page2,pagemax).."]" end n= n+1 diff --git a/item_names.lua b/item_names.lua index d374b14..111c9ee 100644 --- a/item_names.lua +++ b/item_names.lua @@ -1,6 +1,6 @@ -- Based on 4itemnames mod by 4aiman -local item_names = {} -- [player_name] = { hud, dtime, itemname } +local item_names = {} -- [player_name] = { hud, dtime, itemname } local dlimit = 3 -- HUD element will be hidden after this many seconds local air_hud_mod = minetest.get_modpath("4air") local hud_mod = minetest.get_modpath("hud")