Garry's Mod Wiki

util.KeyValuesToTablePreserveOrder

table util.KeyValuesToTablePreserveOrder( string keyvals, boolean usesEscapeSequences = false, boolean preserveKeyCase = false )

Description

Similar to util.KeyValuesToTable but it also preserves order of keys.

Arguments

1 string keyvals
The key value string
2 boolean usesEscapeSequences = false
If set to true, will replace \t, \n, " and \ in the input text with their escaped variants
3 boolean preserveKeyCase = false
Whether we should preserve key case (may fail) or not (always lowercase)

Returns

1 table
The output table

Example

Example usage and output of this function. Note how there are multiple entries where they key is "solid", just like in the input string.

local ModelInfo = util.GetModelInfo("models/combine_gate_vehicle.mdl" ) PrintTable( util.KeyValuesToTablePreserveOrder( ModelInfo.KeyValues ) )
Output:
1: Key = solid Value: 1: Key = index Value = 0 2: Key = name Value = Vehicle_Gate.Gate2_L 3: Key = mass Value = 1 4: Key = surfaceprop Value = metal 5: Key = damping Value = 0 6: Key = rotdamping Value = 0 7: Key = inertia Value = 1 8: Key = volume Value = 68522.9296875 2: Key = solid Value: 1: Key = index Value = 1 2: Key = name Value = Vehicle_Gate.Gate3_R ...

Page Links


Special Pages


Wikis

?

Render Time: 112ms

DB GetPage 58
Generate Html 10
SaveChanges (1) 26
Render Body 0
Render Sidebar 15