projects
/
project
/
luci.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
451eacf
)
libs/core: Add Pythonic string formatting syntax
author
Steven Barth
<steven@midlink.org>
Sun, 24 Aug 2008 16:35:06 +0000
(16:35 +0000)
committer
Steven Barth
<steven@midlink.org>
Sun, 24 Aug 2008 16:35:06 +0000
(16:35 +0000)
libs/core/luasrc/util.lua
patch
|
blob
|
history
diff --git
a/libs/core/luasrc/util.lua
b/libs/core/luasrc/util.lua
index
d8fc666
..
cc15d3a
100644
(file)
--- 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)
--
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
--
-- Class helper routines
--