diff options
author | Steven Barth <steven@midlink.org> | 2008-08-24 16:35:06 +0000 |
---|---|---|
committer | Steven Barth <steven@midlink.org> | 2008-08-24 16:35:06 +0000 |
commit | 0647fadb0a48a34fbf5af1c15532d04dd7277fd0 (patch) | |
tree | f037960c0fe7cacc8d9ec829d6e8be3968db1085 /libs/core/luasrc | |
parent | 451eacf8da90980f9b860db445cb0b04558e9d31 (diff) |
libs/core: Add Pythonic string formatting syntax
Diffstat (limited to 'libs/core/luasrc')
-rw-r--r-- | libs/core/luasrc/util.lua | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/libs/core/luasrc/util.lua b/libs/core/luasrc/util.lua index d8fc66623..cc15d3aeb 100644 --- a/libs/core/luasrc/util.lua +++ b/libs/core/luasrc/util.lua @@ -28,6 +28,20 @@ limitations under the License. module("luci.util", package.seeall) -- +-- Pythonic string formatting extension +-- +getmetatable("").__mod = function(a, b) + if not b then + return a + elseif type(b) == "table" then + return a:format(unpack(b)) + else + return a:format(b) + end +end + + +-- -- Class helper routines -- |