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/03/20 10:06] – [3-point control for a valve or servo] emozolyak | useful_programs [2020/04/17 10:56] – [Debug printing] emozolyak | ||
---|---|---|---|
Line 228: | Line 228: | ||
end | end | ||
+ | </ | ||
+ | |||
+ | For complex tables print, you can use the following function: | ||
+ | <code lua> | ||
+ | function tprint(t, indent) | ||
+ | if not indent then indent = 0 end | ||
+ | for k, v in pairs(t) do | ||
+ | local formatting = string.rep(' | ||
+ | if type(v) == " | ||
+ | ERROR(formatting) | ||
+ | tprint(v, indent + 1) -- recursive call | ||
+ | else | ||
+ | if type(v) == " | ||
+ | v = v and " | ||
+ | end | ||
+ | ERROR(formatting .. v) | ||
+ | end | ||
+ | end -- for | ||
+ | end -- tprint | ||
</ | </ | ||
useful_programs.txt · Last modified: 2024/03/19 09:39 by emozolyak