Skip to content

StarlightIbuki/lua-table-dump

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 

Repository files navigation

lua table dump

A function to dump a lua table in proper format.

Installation

The module has no dependence.

luarocks install table_dump

or

luarocks install https://raw.githubusercontent.com/suikabreaker/lua-table-dump/master/table_dump-1.0-1.rockspec

Usage

Example:

local table_dump = require 'table_dump'
local test = {
    key = "value",
    dict = {
        nested_key = '1',
        1, 2, 3
    }
}

print(table_dump(test, -1, true))

API:

function table_dump(value: any, indent: any, try_tostring: any)  -> string

value accept almost all kind of Lua values. indent defaults to 2, and you can use -1 to output in single line without any indent. When try_tostring set to true, the function will try tostring to output the table before DFS into it.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Lua 100.0%