forked from pyrex/chameleonic
fix double-consume, add %!
I discovered your tostring function for debugging, might as well make it reachable from fmt. I also realized I forgot to convert to using "p" when I introduced it so I fixed that
This commit is contained in:
parent
93c154f876
commit
2264349e72
@ -41,6 +41,8 @@ end
|
|||||||
-- fake sprintf function
|
-- fake sprintf function
|
||||||
-- %~ for literal "%"
|
-- %~ for literal "%"
|
||||||
-- %v for param
|
-- %v for param
|
||||||
|
-- %! for tostring(param)
|
||||||
|
-- which dumps tables
|
||||||
function fmt(f, ...)
|
function fmt(f, ...)
|
||||||
local out, i = "", 1
|
local out, i = "", 1
|
||||||
for s in all(split(f,"%")) do
|
for s in all(split(f,"%")) do
|
||||||
@ -51,9 +53,11 @@ function fmt(f, ...)
|
|||||||
local p = select(i,...)
|
local p = select(i,...)
|
||||||
i+=1
|
i+=1
|
||||||
if m == "v" then
|
if m == "v" then
|
||||||
out ..= select(i,...)
|
out ..= p
|
||||||
|
elseif m == "!" then
|
||||||
|
out ..= tostring(p)
|
||||||
else
|
else
|
||||||
out ..= "(?!:"..m..":"..tostr(p)..")"
|
out ..= "(?!:"..m..":"..tostring(p)..")"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
out ..=sub(s,2)
|
out ..=sub(s,2)
|
||||||
|
Loading…
Reference in New Issue
Block a user