Garry's Mod Wiki

list.Get

  table list.Get( string identifier )

Description

Returns a copy of the list stored at identifier

This function uses table.Copy which can be very slow for larger lists. You should avoid calling it repeatedly or in performance sensitive hooks such as GM:Think.

Where possible you should use the much faster helper functions: list.Contains, list.HasEntry, or list.GetEntry

There is also the more dangerous option of calling list.GetForEdit to get the unprotected list if you absolutely must iterate through it in a think hook.

Arguments

1 string identifier
The list identifier

Returns

1 table
The copy of the list

Example

Get every available NPC from the client:

PrintTable( list.Get( "NPC" ) )
OSZAR »