diff options
author | Y. Wang <yw05@forksworld.de> | 2022-11-02 15:08:21 +0100 |
---|---|---|
committer | Y. Wang <yw05@forksworld.de> | 2022-11-02 15:08:21 +0100 |
commit | 7dea2eba5816e1d7af7b1002c3b4f177ec9b15b5 (patch) | |
tree | f2bf25056ff8521bb64f21d937c16bad79ee82cd /advtrains/l10n.lua | |
parent | a6fc6497e7f187f8fac1d72d826ac893b689f2f6 (diff) | |
download | advtrains-7dea2eba5816e1d7af7b1002c3b4f177ec9b15b5.tar.gz advtrains-7dea2eba5816e1d7af7b1002c3b4f177ec9b15b5.tar.bz2 advtrains-7dea2eba5816e1d7af7b1002c3b4f177ec9b15b5.zip |
Add helper for "insufficient privileges" messages
BREAKING: attrans is now implemented as a table with the __call
metamethod instead of as a function
Diffstat (limited to 'advtrains/l10n.lua')
-rw-r--r-- | advtrains/l10n.lua | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/advtrains/l10n.lua b/advtrains/l10n.lua new file mode 100644 index 0000000..3eb75c9 --- /dev/null +++ b/advtrains/l10n.lua @@ -0,0 +1,20 @@ +local S = minetest.get_translator("advtrains") + +local function S_nopriv(priv, verb, ...) + if verb then + return S(string.format("You are not allowed to %s without the %s privilege.", verb, priv), ...) + else + return S("You do not have the @1 privilege.", priv) + end +end + +local mt = { + __call = function(_, ...) + return S(...) + end, +} + +attrans = { + nopriv = S_nopriv, +} +setmetatable(attrans, mt) |