Getting all keys from a table

I have a table full of keys and those keys have strings in them (irrelevant)

I looked in the wiki about table/GetKeys but it returned a nil value in code.

Question is simple. What would be required in order to get all the keys from a table and put them in a separate table?

table.GetKeys is in fact what you are looking for.

This is what I used:



net.Receive("PA_BannedCLToSL", function(len, ply)
			local table = net.ReadTable()
			
			PA_BannedTable = table
			
			print(table.GetKeys(PA_BannedTable))
		end)


This is what I got





[ERROR] addons/playeradmin/lua/autorun/mainlua/pa_banningcl.lua:36: attempt to call field 'GetKeys' (a nil value)
  1. func - addons/playeradmin/lua/autorun/mainlua/pa_banningcl.lua:36
   2. unknown - lua/includes/modules/net.lua:32


you override the table library with your variable. rename your “local table” to something like “local t” or simply do “PA_BannedTable = …”.

Thanks guys :slight_smile:

(Geez you guys really ARE lua gods why wont you make a really boss gamemode or addon in gamemode that would be awesome!)