Client Specified Tables/Tables on client

Well, I have the following code so far but have found no documentation on what I have done, I’ve seen this method used in a few scripts laying around but never could really find a “Name” for it. The following code seems to work for the most part but does not work on clients side, an example on the client would be like so.

for k,v in pairs( client.PhoneNums ) do --Output: “includes\util.lua:35: bad argument #1 to ‘pairs’ (table expected, got nil)”

Player1 types “APN LawlSauce”, the output would be “1 = “LawlSauce”” for the “PrintTable”.

function AddPhoneNum(ply,cmd,arg)
if(ply.PhoneNums == nil) then ply.PhoneNums = {} end
PrintTable(ply.PhoneNums) --Prints the table, NOT nil at this apparent time.
concommand.Add(“APN”, AddPhoneNum)

I apologize for being vague on this topic.

The problem appears to be that you don’t properly understand Client Server interactions.
The client.PhoneNums table doesn’t exist clientside, the concommand you added only works serverside.
Console commands are a way of clients interacting with the Server. If you want to send information or commands to the client there are two ways, there’s ply:SendLua(‘lua command string’), which is an inefficient way of sending data and you have to be careful about what text you let people put in there.
There’s also NetworkedVariables, however you won’t be able to use this for your phone numbers because you can’t send tables through NetworkedVariables.
Both of the above use Usermessages, depending on the use then it may be more convenient to use the above. Networked Variables for things which you check often and SendLua for commands which you don’t send often and can be very different from each other. For event driven activities usermessages are the best.
[lua]-- Serverside
function PhoneNumber_Add(ply, num)
umsg.Start(“PhoneNumber_Add”, ply)
– Clientside
usermessage.Hook(“PhoneNumber_Add”, function(um)
– here you add the phone number to the table
table.insert(client.PhoneNums, um:ReadString())
This will allow you to add a phonenumber clientside. The code you started with ought to let you add Phone Numbers serverside, so a client could add a phone number and the server would know.