useful_programs
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revision | Next revisionBoth sides next revision | ||
useful_programs [2020/01/13 10:17] – [Debug printing] emozolyak | useful_programs [2020/02/21 13:46] – [Debug printing] emozolyak | ||
---|---|---|---|
Line 142: | Line 142: | ||
function DBG(...) | function DBG(...) | ||
local tc = tabToStr | local tc = tabToStr | ||
- | + | ||
- | local function align2s(s1, s2) -- appends space to smaller string | + | function align2s(s1, s2) -- appends space to smaller string |
- | local d, s = (#s1 - #s2), ' ' | + | local d, s = (#s1 - #s2), ' ' |
- | if (d ~= 0) then return (((d > 0) and {s1, s2 .. s:rep(d)}) or ({s1 .. s:rep(math.abs(d)), s2})) | + | |
+ | if (d ~= 0) then | ||
+ | |||
+ | local Lp, Rp = 0, 0 | ||
+ | |||
+ | if ((ad % 2) == 0) then | ||
+ | Lp = ad / 2 ; Rp = Lp ; INFO(" | ||
+ | else | ||
+ | Lp = math.floor(ad / 2) ; Rp = Lp + 1 ; INFO(" | ||
+ | end | ||
+ | | ||
+ | | ||
+ | ({s:rep(Lp) .. s1 .. s:rep(Rp), s2})) | ||
else | else | ||
return {s1, s2} | return {s1, s2} | ||
Line 154: | Line 166: | ||
local arg_str = tc(arg) | local arg_str = tc(arg) | ||
local t_s_pos = string.find(arg_str, | local t_s_pos = string.find(arg_str, | ||
- | | + | |
if not t_s_pos then | if not t_s_pos then | ||
INFO(arg_str) | INFO(arg_str) | ||
Line 167: | Line 179: | ||
v_row[# | v_row[# | ||
end | end | ||
- | | + | |
if (#h_row ~= #v_row) then | if (#h_row ~= #v_row) then | ||
ERROR(" | ERROR(" | ||
+ | INFO(" | ||
return | return | ||
else | else | ||
Line 180: | Line 193: | ||
end | end | ||
end | end | ||
+ | |||
function tabToStr(t) | function tabToStr(t) | ||
local s = "" | local s = "" |
useful_programs.txt · Last modified: 2024/03/19 09:39 by emozolyak