table.Reverse

From Garry's Mod
Jump to: navigation, search
 table.Reverse( )

Contents

Description

Returns a reversed copy of a sequential table. Any non-sequential and non-numeric keyvalue pairs will not be copied.

Arguments

table tbl

Table to reverse.

Returns

table

A reversed copy of the table.

Examples

Example

Creates a table and reverses it.

local tbl = { "One", "Two", "Three", four = 4, [5] = "5" }

PrintTable(tbl)
print("")
PrintTable(table.Reverse(tbl))

Output:

1	=	One
2	=	Two
3	=	Three
four	=	4
5	=	5

1	=	Three
2	=	Two
3	=	One
Personal tools
Navigation