YT0674
(justa)
April 27, 2024, 8:30pm
#1
Hello!
I want to have a table like this:
local Numbers = {
[5366433] = 1,
[1550005] = 2,
[16433217] = 3,
[309850] = 4,
[43296] = 5,
}
I actually have like 500 lines in the table, I just shortened it for demonstration. I had to write the 500 lines manually. Which took too much time. Is it possible to get a table like this using table.insert
so that I don’t have to do this manually?
azqjanna
(azqjanna)
April 27, 2024, 8:35pm
#2
Yes you can do table.insert in a for loop.
YT0674
(justa)
April 27, 2024, 8:40pm
#3
I think u misunderstood. If I put it in a for loop the numbers would be switched like this:
local Numbers = {
[1] = 5366433,
[2] = 1550005,
[3] = 16433217,
[4] = 309850,
[5] = 43296,
}
My question is how to use table.insert
to make the number in brackets 5366433
1 Like
Crygen54
(Crygen)
April 27, 2024, 8:44pm
#4
Do you mean adding a new line into the table like this ?
Numbers[5366433] = 1
YT0674
(justa)
April 27, 2024, 8:49pm
#5
Oh definitely yes! I didn’t know the solution was this simple. Thank you very much for your help!
2 Likes
system
(system)
Closed
May 11, 2024, 8:50pm
#6
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.