Fix some undeclared global variables
authorCraig Davison <craig.davison3@gmail.com>
Wed, 26 Nov 2014 12:48:43 +0000 (22:48 +1000)
committerCraig Robbins <kde.psych@gmail.com>
Wed, 26 Nov 2014 12:50:08 +0000 (22:50 +1000)
builtin/game/chatcommands.lua
builtin/game/falling.lua

index c215a75c30bcb65bacddd68ffa3dc8eb717858ce..4f7b031aa1d9bca47d6176c48abe5d75f78a91a6 100644 (file)
@@ -252,7 +252,7 @@ core.register_chatcommand("clearpassword", {
        description = "set empty password",
        privs = {password=true},
        func = function(name, param)
-               toname = param
+               local toname = param
                if toname == "" then
                        return false, "Name field required"
                end
@@ -426,6 +426,7 @@ local function handle_give_command(cmd, giver, receiver, stackstring)
                return false, receiver .. " is not a known player"
        end
        local leftover = receiverref:get_inventory():add_item("main", itemstack)
+       local partiality
        if leftover:is_empty() then
                partiality = ""
        elseif leftover:get_count() == itemstack:get_count() then
index 0e45a43754d5f84d9189af86b2655295242f4ad9..58f68fc56f51525f404436a9029e13d21c505d3c 100644 (file)
@@ -30,7 +30,7 @@ core.register_entity(":__builtin:falling_node", {
                        item_texture = core.registered_items[itemname].inventory_image
                        item_type = core.registered_items[itemname].type
                end
-               prop = {
+               local prop = {
                        is_visible = true,
                        textures = {node.name},
                }
@@ -112,7 +112,7 @@ core.register_entity(":__builtin:falling_node", {
 })
 
 function spawn_falling_node(p, node)
-       obj = core.add_entity(p, "__builtin:falling_node")
+       local obj = core.add_entity(p, "__builtin:falling_node")
        obj:get_luaentity():set_node(node)
 end
 
@@ -163,10 +163,10 @@ end
 --
 
 function nodeupdate_single(p, delay)
-       n = core.get_node(p)
+       local n = core.get_node(p)
        if core.get_item_group(n.name, "falling_node") ~= 0 then
-               p_bottom = {x=p.x, y=p.y-1, z=p.z}
-               n_bottom = core.get_node(p_bottom)
+               local p_bottom = {x=p.x, y=p.y-1, z=p.z}
+               local n_bottom = core.get_node(p_bottom)
                -- Note: walkable is in the node definition, not in item groups
                if core.registered_nodes[n_bottom.name] and
                                (core.get_item_group(n.name, "float") == 0 or