From 744b016f935217e3a367c19992c5f46e11f9ba88 Mon Sep 17 00:00:00 2001 From: Vanessa Ezekowitz Date: Sun, 15 Dec 2013 14:07:36 -0500 Subject: [PATCH] local-ize a few variables --- doors_and_gates.lua | 13 +++++++------ furniture.lua | 4 ++-- tables.lua | 2 +- 3 files changed, 10 insertions(+), 9 deletions(-) diff --git a/doors_and_gates.lua b/doors_and_gates.lua index c32c448..f44db5b 100644 --- a/doors_and_gates.lua +++ b/doors_and_gates.lua @@ -4,8 +4,8 @@ local S = homedecor.gettext -- doors -function isSolid(pos,adj) - adj = {x=adj[1],y=adj[2],z=adj[3]} +local function isSolid(pos,adj) + local adj = {x=adj[1],y=adj[2],z=adj[3]} local node = minetest.get_node(vector.add(pos,adj)) if node then local idef = minetest.registered_nodes[minetest.get_node(vector.add(pos,adj)).name] @@ -16,7 +16,7 @@ function isSolid(pos,adj) return false end -function countSolids(pos,node,level) +local function countSolids(pos,node,level) local solids = 0 for x = -1, 1 do for z = -1, 1 do @@ -43,7 +43,7 @@ function countSolids(pos,node,level) return solids end -function calculateClosed(pos) +local function calculateClosed(pos) local node = minetest.get_node(pos) -- the door is considered closed if it is closing off something. @@ -119,7 +119,7 @@ function calculateClosed(pos) end -- isClosed flag, is 0 or 1 0 = open, 1 = closed -function getClosed(pos) +local function getClosed(pos) local isClosed = minetest.get_meta(pos):get_string('closed') if isClosed=='' then if calculateClosed(pos) then @@ -134,7 +134,7 @@ function getClosed(pos) end end -function addDoorNode(pos,def,isClosed) +local function addDoorNode(pos,def,isClosed) if isClosed then isClosed = 1 else @@ -534,6 +534,7 @@ function homedecor.flip_gate(pos, node, player, gate, oc) -- since right facing gates use "open" nodes for closed, we need an -- isClosed flag to tell if it's "really" closed. + local gateresult = nil if oc == "closed" then gateresult = "homedecor:gate_"..gate.."_open" else diff --git a/furniture.lua b/furniture.lua index 1c2914a..de7a3dd 100644 --- a/furniture.lua +++ b/furniture.lua @@ -71,8 +71,8 @@ local chaircolors = { } for i in ipairs(chaircolors) do - color = chaircolors[i][1] - name = chaircolors[i][2] + local color = chaircolors[i][1] + local name = chaircolors[i][2] minetest.register_node("homedecor:armchair_"..color, { description = "Armchair ("..name..")", tiles = { diff --git a/tables.lua b/tables.lua index fcdcac8..cac811b 100644 --- a/tables.lua +++ b/tables.lua @@ -2,7 +2,7 @@ local S = homedecor.gettext -materials = { +local materials = { {"glass","Glass"}, {"wood","Wood"} }