Garry's Mod Wiki

Garry's Mod Wiki

  table, number table.Pack( ... )

Description

Packs a set of items into a table and returns the new table. It is meant as an alternative implementation of table.pack from newer versions of Lua.

Arguments

1 vararg items
The items to pack into a table.

Returns

1 table
A table containing the items.
2 number
The amount of items that were added to the table.

Example

local productID = 234 local productName = "Dark Chocolate" local productIngredients = { "Cocoa Mass", "Cocoa Butter", "Vanilla", "Cocoa Solids: 70% min" } local darkChocolateTable = table.Pack( productID, productName, productIngredients ) PrintTable( darkChocolateTable )
Output:
1 = 234 2 = Dark Chocolate 3: 1 = Cocoa Mass 2 = Cocoa Butter 3 = Vanilla 4 = Cocoa Solids: 70% min

This site is a community mirror of the official Garry's Mod wiki.. This site is not maintained by Facepunch Studios.

Page content is automatically updated twice a day. Edits and history are not available.

Last Parsed: Loading...