diff options
author | Diego MartÃnez <lkaezadl3@yahoo.com> | 2016-10-08 06:07:41 -0300 |
---|---|---|
committer | Diego MartÃnez <lkaezadl3@yahoo.com> | 2016-11-17 19:19:51 -0300 |
commit | 75a0e6a31880bb3b0412288e7add99257805e8d1 (patch) | |
tree | 169dec883ca920880eec83af1034489ece621f0d /init.lua | |
parent | 5b9a53bf293ee07885a2c1ef35d809d356dd672d (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.lua | 12 |
1 files changed, 10 insertions, 2 deletions
@@ -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"), |