{"id":18020943,"url":"https://github.com/edubart/lua-dumper","last_synced_at":"2025-03-26T22:30:31.900Z","repository":{"id":139040046,"uuid":"181338632","full_name":"edubart/lua-dumper","owner":"edubart","description":"A small library for dumping lua variables quickly. This library is typically used for quick debugging values to the terminal where one would use print but want more information about the value (like table content), output to stderr by default (or other file handle) and optionally time elapsed.","archived":false,"fork":false,"pushed_at":"2019-05-03T18:33:11.000Z","size":8,"stargazers_count":6,"open_issues_count":0,"forks_count":3,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-22T14:22:06.062Z","etag":null,"topics":["debug","dump","lua"],"latest_commit_sha":null,"homepage":"","language":"Lua","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/edubart.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-04-14T16:38:03.000Z","updated_at":"2025-01-20T00:38:08.000Z","dependencies_parsed_at":"2023-05-03T10:23:40.178Z","dependency_job_id":null,"html_url":"https://github.com/edubart/lua-dumper","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/edubart%2Flua-dumper","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/edubart%2Flua-dumper/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/edubart%2Flua-dumper/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/edubart%2Flua-dumper/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/edubart","download_url":"https://codeload.github.com/edubart/lua-dumper/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245747385,"owners_count":20665779,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["debug","dump","lua"],"created_at":"2024-10-30T06:08:20.657Z","updated_at":"2025-03-26T22:30:31.881Z","avatar_url":"https://github.com/edubart.png","language":"Lua","readme":"# Dumper\nA small library for dumping lua variables quickly.\nThis library is typically used for quick debugging values\nto the terminal where one would use `print` but want\nmore information about the value (like table content),\noutput to stderr by default (or other file handle) and\noptionally time elapsed.\n\n## Installation\n\n```bash\nluarocks install dumper\n```\n\n## Example Usage\n\nExample using:\n\n```lua\nlocal dumper = require 'dumper'\n\nlocal s, i, b, t = 'string', 1, true, {}\n\n-- dumping\ndumper.dump(s, i, b, t)\n-- outputs: string  1       true    {}\n\n-- inspected dumping\ndumper.idump(s, i, b, t)\n-- outputs: \"string\"        1       true    {}\n\n-- timed dumping\ndumper.tdump() -- reset time\nfor _=1,1000 do\n  -- (do stuff)\nend\ndumper.tdump(\"for loop\")\n-- outputs: 0.050853 ms     for loop\n\n-- import dump functions to _G and set default output to stdout\nrequire 'dumper'.import(io.stdout)\ndump('test')\n-- outputs: test\n```\n\nTipically I setup this in my .bashrc:\n```bash\nexport LUA_INIT=\"require 'dumper'.import()\"\n```\n\nThis make `dumper` functions available as global variables\nwhen running any lua script in your machine. Then in lua script\nsimply run `dump(something)` to debug lua values with nicer format.\n\n## Documentation\n\n### setoutput(output)\nSet dumper output file handle. You can pass here a file handle like\n`io.stdout`, `io.stderr` or a temporary file using `io.tmpfile()`.\nIf value is nil or false dump will not output to any file, instead\nit will only return a formated string.\n\n### dump(...)\nDump any value using `tostring` function except for tables that does not\nhave __tostring metamethod, in this case `inspect` library is used, however\nmetatables are filtered from inspect output. Returns the formated string.\n\n### idump(...)\nDump any value using `inspect` library. Returns the formated string.\n\n### tdump(...)\nDump any value using `dump` and printing the time elapsed since last call,\nall calls resets the timer, calling with no values can be used to just\nreset the timer. Returns the formated string plus the elapsed time\nin nanoseconds.\n\n### bdump(...)\nDump any value using `dump` and printing traceback. Returns the formated\nstring plus the traceback.\n\n### import(output)\nImport `dump`, `idump`, `bdump`, `tdump` functions to _G. Optionally\nan optiona argument `output` specifies the default output when printing.\nfunction dumper.import(out)\n\n## License\n\nMIT\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fedubart%2Flua-dumper","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fedubart%2Flua-dumper","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fedubart%2Flua-dumper/lists"}