diff options
author | ShadowNinja <shadowninja@minetest.net> | 2015-02-01 18:10:09 -0500 |
---|---|---|
committer | ShadowNinja <shadowninja@minetest.net> | 2015-02-01 18:10:09 -0500 |
commit | 4404c4071cddfd7c30b2420be54d184067797482 (patch) | |
tree | d555b2fe6773e8216d811ef95833f18e3cc2d3d4 /README.txt | |
parent | c4335aa3dca1d568167adcf13ec1285b76f25a9a (diff) |
Add numbered insertions
Diffstat (limited to 'README.txt')
-rw-r--r-- | README.txt | 7 |
1 files changed, 7 insertions, 0 deletions
@@ -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 |