forked from pyrex/chameleonic
Compare commits
5 Commits
aefdfeb99c
...
179ee35985
Author | SHA1 | Date | |
---|---|---|---|
179ee35985 | |||
367f03be4a | |||
2ce259304d | |||
e0ebb035e1 | |||
b0bca27239 |
@ -38,6 +38,39 @@ function cycle(tbl,period)
|
|||||||
return tbl[t()%period*#tbl\period+1]
|
return tbl[t()%period*#tbl\period+1]
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- fake sprintf function
|
||||||
|
-- %~ for literal "%"
|
||||||
|
-- %v for param
|
||||||
|
-- %! for tostring(param)
|
||||||
|
-- which dumps tables
|
||||||
|
function fmt(f, ...)
|
||||||
|
local out, i = "", 0
|
||||||
|
for s in all(split(f,"%")) do
|
||||||
|
if i == 0 then
|
||||||
|
-- before first format directive
|
||||||
|
out ..= s
|
||||||
|
i = 1
|
||||||
|
else
|
||||||
|
local m = s[1]
|
||||||
|
if m == "~" then
|
||||||
|
out ..= "%"
|
||||||
|
else
|
||||||
|
local p = select(i,...)
|
||||||
|
i+=1
|
||||||
|
if m == "v" then
|
||||||
|
out ..= p
|
||||||
|
elseif m == "!" then
|
||||||
|
out ..= tostring(p)
|
||||||
|
else
|
||||||
|
out ..= "(?!:"..m..":"..tostring(p)..")"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
out ..=sub(s,2)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
return out
|
||||||
|
end
|
||||||
|
|
||||||
mnames={}
|
mnames={}
|
||||||
function names(root)
|
function names(root)
|
||||||
local n=mnames[root]
|
local n=mnames[root]
|
||||||
@ -269,7 +302,7 @@ function title:draw()
|
|||||||
print("pyrex",32,73,7)
|
print("pyrex",32,73,7)
|
||||||
print("[nyeogmi]",62,73,7)
|
print("[nyeogmi]",62,73,7)
|
||||||
print("kistaro",32,79,7)
|
print("kistaro",32,79,7)
|
||||||
local lvlstr = "⬅️ "..start_level.." ➡️"
|
local lvlstr = fmt("⬅️ %v ➡️",start_level)
|
||||||
print(lvlstr,50,91,1)
|
print(lvlstr,50,91,1)
|
||||||
print(lvlstr,51,90,blinkcol)
|
print(lvlstr,51,90,blinkcol)
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user