Garry's Mod Wiki

Revision Difference

Global.PrintTable#511338

<function name="PrintTable" parent="Global" type="libraryfunc">⤶ <description>Recursively prints the contents of a table to the console.</description>⤶ <realm>Shared and Menu</realm>⤶ <file line="58-L92">lua/includes/util.lua</file>⤶ <args>⤶ <arg name="tableToPrint" type="table">The table to be printed</arg>⤶ <arg name="indent" type="number" default="0">Number of tabs to start indenting at. Increases by 2 when entering another table.</arg>⤶ <arg name="done" type="table" default="{}">Internal argument, you shouldn&#x27;t normally change this. Used to check if a nested table has already been printed so it doesn&#x27;t get caught in a loop.</arg>⤶ </args>⤶ </function>⤶ ⤶ <example>⤶ <description>Prints the table we created.</description>⤶ <code>⤶ local tbl = {⤶ "test",⤶ 3829.4,⤶ {"foo", "baah", 20/5},⤶ true⤶ }⤶ PrintTable(tbl)⤶ </code>⤶ <output>⤶ &amp;lt;pre&amp;lt;noinclude&amp;gt;&amp;lt;/noinclude&amp;gt;&amp;gt;1 = test⤶ 2 = 3829.4⤶ 3:⤶ ```⤶ ⤶ 1 = foo⤶ 2 = baah⤶ 3 = 4⤶ ```⤶ ⤶ 4 = true&amp;lt;/pre&amp;lt;noinclude&amp;gt;&amp;lt;/noinclude&amp;gt;&amp;gt;⤶ </output>⤶ ⤶ </example>