From 41a10a86d5d2257778b2e422b8a560ed8ea2cbba Mon Sep 17 00:00:00 2001
From: Tim <t4im@users.noreply.github.com>
Date: Thu, 05 Feb 2015 10:09:14 +0100
Subject: [PATCH] reduce intllib code

---
 concrete/init.lua           |    7 +------
 technic_worldgen/init.lua   |    9 +++------
 technic/init.lua            |    8 ++------
 technic_chests/register.lua |    9 +--------
 extranodes/init.lua         |    7 +------
 wrench/init.lua             |    7 +------
 6 files changed, 9 insertions(+), 38 deletions(-)

diff --git a/concrete/init.lua b/concrete/init.lua
index 660624a..de96738 100644
--- a/concrete/init.lua
+++ b/concrete/init.lua
@@ -5,12 +5,7 @@
 technic.concrete_posts = {}
 
 -- Boilerplate to support localized strings if intllib mod is installed.
-local S
-if rawget(_G, "intllib") then
-	S = intllib.Getter()
-else
-	S = function(s) return s end
-end
+local S = rawget(_G, "intllib") and intllib.Getter() or function(s) return s end
 
 minetest.register_alias("technic:concrete_post",   "technic:concrete_post0")
 minetest.register_alias("technic:concrete_post32", "technic:concrete_post12")
diff --git a/extranodes/init.lua b/extranodes/init.lua
index 2b04812..6f96217 100644
--- a/extranodes/init.lua
+++ b/extranodes/init.lua
@@ -1,12 +1,7 @@
 -- Minetest 0.4.6 mod: extranodes
 -- namespace: technic
 -- Boilerplate to support localized strings if intllib mod is installed.
-local S
-if rawget(_G, "intllib") then
-	S = intllib.Getter()
-else
-	S = function(s) return s end
-end
+local S = rawget(_G, "intllib") and intllib.Getter() or function(s) return s end
 
 -- register stairsplus/circular_saw nodes
 -- we skip blast resistant concrete and uranium intentionally
diff --git a/technic/init.lua b/technic/init.lua
index ef4e98f..adb1458 100644
--- a/technic/init.lua
+++ b/technic/init.lua
@@ -16,12 +16,8 @@
 technic.modpath = modpath
 
 -- Boilerplate to support intllib
-if rawget(_G, "intllib") then
-	technic.getter = intllib.Getter()
-else
-	technic.getter = function(s) return s end
-end
-local S = technic.getter
+local S = rawget(_G, "intllib") and intllib.Getter() or function(s) return s end
+technic.getter = S
 
 -- Read configuration file
 dofile(modpath.."/config.lua")
diff --git a/technic_chests/register.lua b/technic_chests/register.lua
index 68ee6b1..14baa95 100644
--- a/technic_chests/register.lua
+++ b/technic_chests/register.lua
@@ -1,11 +1,4 @@
-
-
-local S
-if rawget(_G, "intllib") then
-	S = intllib.Getter()
-else
-	S = function(s) return s end
-end
+local S = rawget(_G, "intllib") and intllib.Getter() or function(s) return s end
 
 local chest_mark_colors = {
 	{"black", S("Black")},
diff --git a/technic_worldgen/init.lua b/technic_worldgen/init.lua
index bee44c4..2f36920 100644
--- a/technic_worldgen/init.lua
+++ b/technic_worldgen/init.lua
@@ -1,12 +1,9 @@
 local modpath = minetest.get_modpath("technic_worldgen")
 
 technic = rawget(_G, "technic") or {}
-technic.worldgen = {}
-if rawget(_G, "intllib") then
-	technic.worldgen.gettext = intllib.Getter()
-else
-	technic.worldgen.gettext = function(s) return s end
-end
+technic.worldgen = {
+	gettext = rawget(_G, "intllib") and intllib.Getter() or function(s) return s end,
+}
 
 dofile(modpath.."/config.lua")
 dofile(modpath.."/nodes.lua")
diff --git a/wrench/init.lua b/wrench/init.lua
index f971970..fbe1e10 100644
--- a/wrench/init.lua
+++ b/wrench/init.lua
@@ -20,12 +20,7 @@
 dofile(modpath.."/technic.lua")
 
 -- Boilerplate to support localized strings if intllib mod is installed.
-local S
-if rawget(_G, "intllib") then
-	S = intllib.Getter()
-else
-	S = function(s) return s end
-end
+local S = rawget(_G, "intllib") and intllib.Getter() or function(s) return s end
 
 local function get_meta_type(name, metaname)
 	local def = wrench.registered_nodes[name]

--
Gitblit v1.8.0