recursive output all the table content

简介:

function print_tbl(v_s) 
  if type(v_s) == "table" then
    print(v_s, "contents:-----------------------------------------------")
    for k,v in pairs(v_s) do 
      if type(v_s[k]) == "table" 
      then 
        print(v_s,k,v)
        print_tbl(v_s[k]) 
      else 
        print(v_s,k,v) 
      end 
    end
  else
    error("please enter a table variable.")
  end
end

> s = require("socket")

> print_tbl(s)
table: 0x15b9410        contents:-----------------------------------------------
table: 0x15b9410        dns     table: 0x15b95c0
table: 0x15b95c0        contents:-----------------------------------------------
table: 0x15b95c0        getaddrinfo     function: 0x7f5d2c2ded80
table: 0x15b95c0        gethostname     function: 0x7f5d2c2deb20
table: 0x15b95c0        toip    function: 0x7f5d2c2df1d0
table: 0x15b95c0        getnameinfo     function: 0x7f5d2c2deba0
table: 0x15b95c0        tohostname      function: 0x7f5d2c2df140
table: 0x15b9410        __unload        function: 0x7f5d2c2dc510
table: 0x15b9410        choose  function: 0x15bb6b0
table: 0x15b9410        sink    function: 0x15badc0
table: 0x15b9410        sourcet table: 0x15bb6e0
table: 0x15bb6e0        contents:-----------------------------------------------
table: 0x15bb6e0        default function: 0x15baee0
table: 0x15bb6e0        by-length       function: 0x15bae00
table: 0x15bb6e0        until-closed    function: 0x15baee0
table: 0x15b9410        skip    function: 0x7f5d2c2dc520
table: 0x15b9410        _VERSION        LuaSocket 3.0-rc1
table: 0x15b9410        source  function: 0x15bafd0
table: 0x15b9410        sleep   function: 0x7f5d2c2dc6b0
table: 0x15b9410        udp     function: 0x7f5d2c2e1450
table: 0x15b9410        BLOCKSIZE       2048
table: 0x15b9410        tcp     function: 0x7f5d2c2e0b30
table: 0x15b9410        _SETSIZE        1024
table: 0x15b9410        sinkt   table: 0x15bb730
table: 0x15bb730        contents:-----------------------------------------------
table: 0x15bb730        default function: 0x15bb7e0
table: 0x15bb730        close-when-done function: 0x15bb780
table: 0x15bb730        keep-open       function: 0x15bb7e0
table: 0x15b9410        newtry  function: 0x7f5d2c2dfe70
table: 0x15b9410        select  function: 0x7f5d2c2e0360
table: 0x15b9410        try     function: 0x15bbeb0
table: 0x15b9410        bind    function: 0x15b94c0
table: 0x15b9410        connect6        function: 0x15bbe50
table: 0x15b9410        protect function: 0x7f5d2c2dfda0
table: 0x15b9410        gettime function: 0x7f5d2c2dc7b0
table: 0x15b9410        connect4        function: 0x15b9640
table: 0x15b9410        connect function: 0x7f5d2c2e0780
table: 0x15b9410        udp6    function: 0x7f5d2c2e1440
table: 0x15b9410        tcp6    function: 0x7f5d2c2e0b20

相关文章
|
21天前
Transparent Data Encryption Data Dynamic and Data Dictionary Views You can query a set of dynamic and data dictionary views to find more information about Transparent Data Encryption (TDE) data.
Transparent Data Encryption Data Dynamic and Data Dictionary Views You can query a set of dynamic and data dictionary views to find more information about Transparent Data Encryption (TDE) data.
11 2
|
6月前
InvalidJobConfException: Output directory not set
InvalidJobConfException: Output directory not set
27 0
|
9月前
|
关系型数据库 MySQL 数据库
View ‘information_schema.SCHEMATA‘ references invalid table(s) or column(s) or function(s) or define
View ‘information_schema.SCHEMATA‘ references invalid table(s) or column(s) or function(s) or define
136 0
|
数据库
Incorrect table definition; there can be only one auto column and it must be defined as a key
Incorrect table definition; there can be only one auto column and it must be defined as a key
121 0
Incorrect table definition; there can be only one auto column and it must be defined as a key
when click one item in table Select at least one column to perform the search
when click one item in table Select at least one column to perform the search
when click one item in table Select at least one column to perform the search
How to analyze the dump MESSAGE_TYPE_X when modifying an attachment
Created by Jerry Wang, last modified on Mar 04, 2014 The real problem could be reproduced by following the four steps below:
113 0
How to analyze the dump MESSAGE_TYPE_X when modifying an attachment
UDO report generate DDIC table
UDO report generate DDIC table
118 0
UDO report generate DDIC table
open a BP will trigger text load - COM_TEXT_MAINTAIN - READ_TEXT
open a BP will trigger text load - COM_TEXT_MAINTAIN - READ_TEXT
open a BP will trigger text load - COM_TEXT_MAINTAIN - READ_TEXT
OPA 15 - find existing item by its type.note
Created by Wang, Jerry, last modified on Nov 08, 2015
124 0
OPA 15 - find existing item by its type.note