BOOC2002
(BOOC2002)
March 28, 2023, 4:37am
#1
What do you want to achieve? the script print
[1] = 2
[2] = 3
[3] = 4
[4] = 5
What is the issue? but he Print this
script
local Tab = {2,3,4,5}
table.sort(Tab)
print(Tab)
What solutions have you tried so far? Did you look for solutions on the Developer Hub?
I look but this But there is no such request.
2 Likes
You are printing out the table as you have displayed above instead of iterating through the table using for loops,
BOOC2002:
print(Tab)
hence why it’s printing out the table name rather than the values in the table.
1 Like
DasKairo
(Cairo)
March 28, 2023, 4:47am
#3
That usually only happens when you do this:
print(tostring(Tab))
Which more so prints the “Id” of the table.
It should normally print out this:
{...} or {}
Not nessacarly.
1 Like
Will print what you show…
for k, v in pairs(Tab) do print(string.format('[%d] = %s', k, v)) end
Will print just the values in a series…
print(unpack(Tab))
1 Like
DasKairo
(Cairo)
March 28, 2023, 4:53am
#5
That doesnt seem nessacary, Table that are printed in the output already do this.
YosemiteMe:
Will print what you show…
for k, v in pairs(Tab) do print(string.format('[%d] = %s', k, v)) end
-- The Timestamp is just the time I printed this, Ignore it if you want.
21:54:13.777 â–Ľ { -- Opened Table
[1] = 2,
[2] = 3,
[3] = 4,
[4] = 5
} - Edit
21:54:13.777 â–¶ {...} - Edit -- Closed Table
21:54:13.777 {} - Edit -- Empty Table
1 Like
BOOC2002
(BOOC2002)
March 28, 2023, 4:56am
#6
Almost everything is like that but there is one problem yes and I have a lot of questions but not now Here is the problem
i need this only
[1] = 2
[2] = 3
[3] = 4
[4] = 5
And there is a way not to write all this and more? It’s terribly inconvenient.
1 Like
DasKairo
(Cairo)
March 28, 2023, 4:57am
#7
You just simply print the table, it doesnt make sense as to why you are getting the name of the table.
1 Like
BOOC2002
(BOOC2002)
March 28, 2023, 5:01am
#8
This is very strange because on the Internet I saw a script where it already worked
And this is the result
{…} - Edit
[1] = 6
[2] = 3
[3] = 9
[4] = 7
1 Like
DasKairo
(Cairo)
March 28, 2023, 5:04am
#9
Ok, so I think I know why you are getting this, try clicking on the 3 dots on the Output, and Disable Log Mode , that may be why you are getting this.
4 Likes
BOOC2002
(BOOC2002)
March 28, 2023, 5:09am
#10
Honestly, I did not expect an error here, I have a question why It was here that there was an error
1 Like
DasKairo
(Cairo)
March 28, 2023, 5:11am
#11
All it really does is to “Simplify the Output” according to the Output Documentation
And It isnt an error, Its just an Option you can Enable / Disable.
1 Like
BOOC2002
(BOOC2002)
March 28, 2023, 5:13am
#12
Good to know for the future thanks for the help!
2 Likes
system
(system)
Closed
April 11, 2023, 5:14am
#13
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.