Table Function - How can i sett the Data in 1 Line of a Table

Hello,

im currently get this:

1 = 5
2 = 1
3 = 0
4 = 0
5 = Bürger
6 = 76561198399527982
7 = TestChar

	table.insert( PlayerListTable,k,v:GetName()) -- Name --
	table.insert( PlayerListTable,k,v:SteamID64()) -- SteamID --
	table.insert( PlayerListTable,k,v:getDarkRPVar("job")) -- Beruf --
	table.insert( PlayerListTable,k,v:Frags()) -- Kills --
	table.insert( PlayerListTable,k,v:Deaths()) -- Tode --
	table.insert( PlayerListTable,k,math.Round(v:GetUTimeTotalTime()/3600)) -- Spielerzeit --
	table.insert( PlayerListTable,k,v:Ping()) -- Ping --

but i want it to:

1 = 5,1,0,0,Bürger,76561198399527982,TestChar

Anyone can help me? Can’t find anythink.

Just learning Lua and Gmod dev.

Info: I wanted to use this on my Scoreboard for Sorting the DarkRP Jobs, its work fine but still the Sorting missing

Thx

Insert player data as a table.

I don’t understand. Can you be more clear?

  1. Post your complete code.
  2. Explain what you’re having trouble with. I don’t see anything wrong with what you said.

When posting your code on the forum, do it like this:
[noparse][lua]
– your code goes here
[/lua][/noparse]

Then it will look like this:
[lua]
– your code goes here
[/lua]

I just want to add this data:

	table.insert( PlayerListTable,k,v:GetName()) -- Name --
	table.insert( PlayerListTable,k,v:SteamID64()) -- SteamID --
	table.insert( PlayerListTable,k,v:getDarkRPVar("job")) -- Beruf --
	table.insert( PlayerListTable,k,v:Frags()) -- Kills --
	table.insert( PlayerListTable,k,v:Deaths()) -- Tode --
	table.insert( PlayerListTable,k,math.Round(v:GetUTimeTotalTime()/3600)) -- Spielerzeit --
	table.insert( PlayerListTable,k,v:Ping()) -- Ping --

====

1 = 5
2 = 1
3 = 0
4 = 0
5 = Bürger
6 = 76561198399527982
7 = TestChar
8 = Another Account …

in 1 line:

1 = 5,1,0,0,Bürger,76561198399527982,TestChar
2 = Another Account
3 = Another Account
4 = Another Account

Oh, then do as G4MB!T said:

[lua]table.insert(PlayerListTable, {
ply:GetName(),
ply:SteamID64(),
ply:getDarkRPVar(“job”),
ply:Frags(),
ply:Deaths(),
math.Round(ply:GetUTimeTotalTime()/3600),
ply:Ping()
})[/lua]



local tbl = {  v:GetName(), v:GetSteamID64(), v:getDarkRPVar("jobs"), v:Frags(), v:Deaths(), math.Round(v:GetUTimeTotalTime()/3600), v:Ping() }

table.insert( PlayerListTable, k, tbl )


Edit: Literally sniped, his method is better anyway so use NeatNit’s

Okay, thank you!

Sorry for by bad english :slight_smile:

Works well, thank you, still learning lua and gmod development, thank you!