Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

9
LINES

< > BotCompany Repo | #152 // luaPrintVars, initial version

Lua code

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")

Author comment

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

Image recognition results

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: 765 / 173
Referenced in: [show references]