summaryrefslogtreecommitdiff
path: root/README.txt
diff options
context:
space:
mode:
authorShadowNinja <shadowninja@minetest.net>2015-02-01 18:10:09 -0500
committerShadowNinja <shadowninja@minetest.net>2015-02-01 18:10:09 -0500
commit4404c4071cddfd7c30b2420be54d184067797482 (patch)
treed555b2fe6773e8216d811ef95833f18e3cc2d3d4 /README.txt
parentc4335aa3dca1d568167adcf13ec1285b76f25a9a (diff)
Add numbered insertions
Diffstat (limited to 'README.txt')
-rw-r--r--README.txt7
1 files changed, 7 insertions, 0 deletions
diff --git a/README.txt b/README.txt
index b2cd5b8..4fc43cd 100644
--- a/README.txt
+++ b/README.txt
@@ -15,7 +15,14 @@ it at the beginning of your source file(s):
if minetest.get_modpath("intllib") then
S = intllib.Getter()
else
+ -- If you don't use insertions (@1, @2, etc) you can use this:
S = function(s) return s end
+
+ -- If you use insertions, but not insertion escapes this will work:
+ S = function(s,a,...)a={a,...}return s:gsub("@(%d+)",function(n)return a[tonumber(n)]end)end
+
+ -- Use this if you require full functionality
+ S = function(s,a,...)if a==nil then return s end a={a,...}return s:gsub("(@?)@(%(?)(%d+)(%)?)",function(e,o,n,c)if e==""then return a[tonumber(n)]..(o==""and c or"")else return"@"..o..n..c end end) end
end
You will also need to optionally depend on intllib, to do so add "intllib?" to