libs/core: Add Pythonic string formatting syntax

This commit is contained in:
Steven Barth 2008-08-24 16:35:06 +00:00
parent 451eacf8da
commit 0647fadb0a

View file

@ -27,6 +27,20 @@ limitations under the License.
--- LuCI utility functions.
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
--