summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDiego Martínez <kaeza@users.noreply.github.com>2017-01-27 10:18:28 -0300
committerDiego Martínez <kaeza@users.noreply.github.com>2017-01-27 10:18:28 -0300
commit8eae4eec38de0669623328049ebb873c18c3af1e (patch)
tree058b682d2fe530eff131227b3c64cbbf9679cf56
parentb98f01b2da0e6815724d02bf0de1abf2f6a8a086 (diff)
Logging fixes.
* Remove use of `rawget`. * Fix code trying to concat a nil value in some cases. * Prefix warnings with mod name.
-rw-r--r--gettext.lua10
1 files changed, 3 insertions, 7 deletions
diff --git a/gettext.lua b/gettext.lua
index 62524f5..38d515e 100644
--- a/gettext.lua
+++ b/gettext.lua
@@ -136,7 +136,7 @@ local function detect_languages()
local v
- v = rawget(_G, "minetest") and minetest.setting_get("language")
+ v = minetest.setting_get("language")
if v and v~="" then
addlang(v)
end
@@ -157,11 +157,7 @@ local function detect_languages()
end
local function warn(msg)
- if rawget(_G, "minetest") then
- minetest.log("warning", msg)
- else
- io.stderr:write("WARNING: ", msg, "\n")
- end
+ minetest.log("warning", "[intllib] "..msg)
end
-- hax!
@@ -224,7 +220,7 @@ local function load_catalog(filename)
local f, data, err
local function bail(msg)
- warn(msg..(err and ": ")..(err or ""))
+ warn(msg..(err and ": " or "")..(err or ""))
return nil
end