Stop shadowing upvalues and definitions.
authorTim <t4im@users.noreply.github.com>
Sun, 26 Jun 2016 12:46:15 +0000 (14:46 +0200)
committerparamat <mat.gregory@virginmedia.com>
Fri, 15 Jul 2016 20:58:49 +0000 (21:58 +0100)
mods/beds/api.lua
mods/creative/init.lua
mods/doors/init.lua
mods/fire/init.lua
mods/tnt/init.lua

index d640a311118782001f01ec78217ccf8257cf384b..3624ea45cc382ae0aab3ad1da2e4aae97b1ac3ae 100644 (file)
@@ -59,8 +59,8 @@ function beds.register_bed(name, def)
                                return itemstack
                        end
 
-                       local def = minetest.registered_nodes[minetest.get_node(pos).name]
-                       if not def or not def.buildable_to then
+                       local node_def = minetest.registered_nodes[minetest.get_node(pos).name]
+                       if not node_def or not node_def.buildable_to then
                                return itemstack
                        end
 
@@ -113,8 +113,8 @@ function beds.register_bed(name, def)
                        end
                        local newp = vector.add(pos, minetest.facedir_to_dir(new_param2))
                        local node3 = minetest.get_node_or_nil(newp)
-                       local def = node3 and minetest.registered_nodes[node3.name]
-                       if not def or not def.buildable_to then
+                       local node_def = node3 and minetest.registered_nodes[node3.name]
+                       if not node_def or not node_def.buildable_to then
                                return false
                        end
                        if minetest.is_protected(newp, user:get_player_name()) then
index abb11aa54b9b09030a56975183f259c3684a9112..1e7b408744f058681eecdd7cff867224b6c32ead 100644 (file)
@@ -5,15 +5,16 @@ local player_inventory = {}
 local creative_mode = minetest.setting_getbool("creative_mode")
 
 -- Create detached creative inventory after loading all mods
-creative.init_creative_inventory = function(player)
-       local player_name = player:get_player_name()
-       player_inventory[player_name] = {}
-       player_inventory[player_name].size = 0
-       player_inventory[player_name].filter = ""
-       player_inventory[player_name].start_i = 1
-       player_inventory[player_name].tab_id = 2
+creative.init_creative_inventory = function(owner)
+       local owner_name = owner:get_player_name()
+       player_inventory[owner_name] = {
+               size = 0,
+               filter = "",
+               start_i = 1,
+               tab_id = 2,
+       }
 
-       minetest.create_detached_inventory("creative_" .. player_name, {
+       minetest.create_detached_inventory("creative_" .. owner_name, {
                allow_move = function(inv, from_list, from_index, to_list, to_index, count, player)
                        if creative_mode and not to_list == "main" then
                                return count
@@ -45,7 +46,7 @@ creative.init_creative_inventory = function(player)
                end,
        })
 
-       creative.update_creative_inventory(player_name)
+       creative.update_creative_inventory(owner_name)
        --print("creative inventory size: " .. player_inventory[player_name].size)
 end
 
index f39cedff38018248ffa415386ce15d2d9a97c62c..7e587dcf7188f6987320312a0c624d4efce5fa3a 100644 (file)
@@ -344,11 +344,11 @@ function doors.register(name, def)
                        return true
                end
                local meta = minetest.get_meta(pos)
-               local name
+               local owner_name
                if digger then
-                       name = digger:get_player_name()
+                       owner_name = digger:get_player_name()
                end
-               return meta:get_string("doors_owner") == name
+               return meta:get_string("doors_owner") == owner_name
        end
 
        if not def.sounds then
index 08b53a89dfed3c237209cabfa8003d018c1c00eb..90e2f0a8700c780388491861a585e36184cdbd89 100644 (file)
@@ -284,8 +284,8 @@ else
                        local p = minetest.find_node_near(p0, 1, {"group:flammable"})
                        if p then
                                -- remove flammable nodes around flame
-                               local node = minetest.get_node(p)
-                               local def = minetest.registered_nodes[node.name]
+                               local flammable_node = minetest.get_node(p)
+                               local def = minetest.registered_nodes[flammable_node.name]
                                if def.on_burn then
                                        def.on_burn(p)
                                else
index 023a39b15f48dd94e696e59b640de7c0b8748f44..c5aa95c9193678a60e1138b5bcf81eefe300785a 100644 (file)
@@ -12,7 +12,7 @@ local loss_prob = {}
 loss_prob["default:cobble"] = 3
 loss_prob["default:dirt"] = 4
 
-local radius = tonumber(minetest.setting_get("tnt_radius") or 3)
+local tnt_radius = tonumber(minetest.setting_get("tnt_radius") or 3)
 
 -- Fill a list with data for content IDs, after all nodes are registered
 local cid_data = {}
@@ -345,10 +345,10 @@ local function tnt_explode(pos, radius, ignore_protection, ignore_on_blast)
        end
        end
 
-       for _, data in ipairs(on_blast_queue) do
-               local dist = math.max(1, vector.distance(data.pos, pos))
+       for _, queued_data in ipairs(on_blast_queue) do
+               local dist = math.max(1, vector.distance(queued_data.pos, pos))
                local intensity = (radius * radius) / (dist * dist)
-               local node_drops = data.on_blast(data.pos, intensity)
+               local node_drops = queued_data.on_blast(queued_data.pos, intensity)
                if node_drops then
                        for _, item in ipairs(node_drops) do
                                add_drop(drops, item)
@@ -589,5 +589,5 @@ end
 tnt.register_tnt({
        name = "tnt:tnt",
        description = "TNT",
-       radius = radius,
+       radius = tnt_radius,
 })