local lines = {}
for k, v in pairs(_G) do
if type(v) == 'number' then
table.insert(lines, k..'='..tostring(v))
elseif type(v) == 'string' then
table.insert(lines, k..'='..('%q'):format(v))
end
end
return table.concat(lines, "\\n")Initial version of #151 that could handle only numbers and strings. And no special characters in _G keys, but that is nasty anyways, nobody does it!
test run test run with input download show line numbers
Travelled to 12 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt
No comments. add comment
| Recognizer | Recognition Result | Visualize | Recalc |
|---|---|---|---|
| #308 | 252 | [visualize] |
| Snippet ID: | #152 |
| Snippet name: | luaPrintVars, initial version |
| Eternal ID of this version: | #152/1 |
| Text MD5: | 861b108220ddb71db7ed7d174c41b73a |
| Author: | stefan |
| Category: | internal helpers |
| Type: | Lua code |
| Public (visible to everyone): | Yes |
| Archived (hidden from active list): | No |
| Created/modified: | 2014-01-13 03:23:53 |
| Source code size: | 252 bytes / 9 lines |
| Pitched / IR pitched: | Yes / Yes |
| Views / Downloads: | 1258 / 304 |
| Referenced in: | #3000382 - Answer for ferdie (>> t = 1, f = 0) |