aboutsummaryrefslogtreecommitdiff
path: root/advtrains
diff options
context:
space:
mode:
authorY. Wang <yw05@forksworld.de>2022-11-03 19:53:30 +0100
committerY. Wang <yw05@forksworld.de>2024-04-13 10:36:35 +0200
commiteb0d05059c879520a77774702cc7a678d06c42e1 (patch)
tree5b2b4995e52becf34868525e893580f6615f8165 /advtrains
parentbf9f9f97a926dd32433e63ba2f308e9a16bc5e23 (diff)
downloadadvtrains-eb0d05059c879520a77774702cc7a678d06c42e1.tar.gz
advtrains-eb0d05059c879520a77774702cc7a678d06c42e1.tar.bz2
advtrains-eb0d05059c879520a77774702cc7a678d06c42e1.zip
Add documentation
Diffstat (limited to 'advtrains')
-rw-r--r--advtrains/l10n.lua19
1 files changed, 19 insertions, 0 deletions
diff --git a/advtrains/l10n.lua b/advtrains/l10n.lua
index 3eb75c9..be39587 100644
--- a/advtrains/l10n.lua
+++ b/advtrains/l10n.lua
@@ -1,5 +1,23 @@
+--- Advtrains l10n module.
+-- Advtrains' l10n module is built on top of
+-- [Minetest's](https://minetest.gitlab.io/minetest/translations/).
+-- @module attrans
+-- @alias mt
+
+--- Wrapper for `minetest.translate`.
+-- Note that this function is also called when calling the `attrans`
+-- *table* itself. Doing so is encourged as `attrans.attrans` is only
+-- intended for situations where only functions are accepted.
+-- @function attrans
+-- @param str The string to translate.
+-- @param[opt] ... Additional arguments to pass to `minetest.translate`.
local S = minetest.get_translator("advtrains")
+--- Generate an error message that a user does not have a specific privilege.
+-- @function nopriv
+-- @param priv The privilege that is missing.
+-- @param[opt] verb The action that is denied.
+-- @param[optchain] ... Additional arguments to pass to `minetest.translate`.
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), ...)
@@ -15,6 +33,7 @@ local mt = {
}
attrans = {
+ attrans = S,
nopriv = S_nopriv,
}
setmetatable(attrans, mt)