summaryrefslogtreecommitdiff
path: root/init.lua
diff options
context:
space:
mode:
authorDiego Martínez <lkaezadl3@yahoo.com>2016-10-08 06:07:41 -0300
committerDiego Martínez <lkaezadl3@yahoo.com>2016-11-17 19:19:51 -0300
commit75a0e6a31880bb3b0412288e7add99257805e8d1 (patch)
tree169dec883ca920880eec83af1034489ece621f0d /init.lua
parent5b9a53bf293ee07885a2c1ef35d809d356dd672d (diff)
Bags: Code cleanup and per-bag trash slot.
* Turn page creation into a loop. * Add per-bag trash slot. * Changed i18n to allow replacements.
Diffstat (limited to 'init.lua')
-rw-r--r--init.lua12
1 files changed, 10 insertions, 2 deletions
diff --git a/init.lua b/init.lua
index e24fff2..f92d278 100644
--- a/init.lua
+++ b/init.lua
@@ -2,7 +2,15 @@
local modpath = minetest.get_modpath(minetest.get_current_modname())
local worldpath = minetest.get_worldpath()
-local mygettext = rawget(_G, "intllib") and intllib.Getter() or function(s) return s end
+local mygettext
+if rawget(_G, "intllib") then
+ mygettext = intllib.Getter()
+else
+ function mygettext(s, ...)
+ local t = { ... }
+ return (s:gsub("@(%d+)", function(n) return t[tonumber(n)] end))
+ end
+end
-- Data tables definitions
unified_inventory = {
@@ -33,7 +41,7 @@ unified_inventory = {
-- intllib
gettext = mygettext,
- fgettext = function(s) return minetest.formspec_escape(mygettext(s)) end,
+ fgettext = function(...) return minetest.formspec_escape(mygettext(...)) end,
-- "Lite" mode
lite_mode = minetest.setting_getbool("unified_inventory_lite"),