Garry's Mod Wiki

table.CollapseKeyValue

  table table.CollapseKeyValue( table input )

Description

Collapses a table with keyvalue structure

Arguments

1 table input
Input table

Returns

1 table
Output table

Example

Example usage

local output = table.CollapseKeyValue( { { Key = "mykey1", Value = "myvalue1" }, { Key = 123, Value = 1345 }, { Key = 1345, Value = "myvalue1" }, } )
Output:
local output = { [ "mykey1" ] = "myvalue1", [ 123 ] = 1345, [ 1345 ] = "myvalue1", }