summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--libs/core/luasrc/util.lua14
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
--