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.

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

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

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

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)
umsg.String(num)
umsg.End()
end
– Clientside
usermessage.Hook(“PhoneNumber_Add”, function(um)
– here you add the phone number to the table
table.insert(client.PhoneNums, um:ReadString())
end)
[/lua]
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.