aboutsummaryrefslogtreecommitdiff
path: root/advtrains/l10n.lua
diff options
context:
space:
mode:
authorY. Wang <yw05@forksworld.de>2022-11-02 15:08:21 +0100
committerY. Wang <yw05@forksworld.de>2024-04-13 10:36:35 +0200
commitbf9f9f97a926dd32433e63ba2f308e9a16bc5e23 (patch)
treef35e5153a2bf6aadd4154696acf6c70fedac3ebc /advtrains/l10n.lua
parente726163a9ccc842e5c4d00e86a11f75d3c6313e3 (diff)
downloadadvtrains-bf9f9f97a926dd32433e63ba2f308e9a16bc5e23.tar.gz
advtrains-bf9f9f97a926dd32433e63ba2f308e9a16bc5e23.tar.bz2
advtrains-bf9f9f97a926dd32433e63ba2f308e9a16bc5e23.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.lua20
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)