|
| 08 Apr 2012 08:45 PM |
Hi, I need help for my game I need to sort a table of data (Array) and convert it to numeric order: eg:
TABLE = {3,5,2,6,1}
And when it is done It should be:
TABLE = {1,2,3,5,6}
If someone can give me a script or something it will be helpful! Thanks,
-Sponge
|
|
|
| Report Abuse |
|
|
|
| 08 Apr 2012 08:47 PM |
table.sort
These trivial questions should be taken to Scripting Helpers, NOT to Scripters--Scripters is for people who are confident in knowing what they are talking about with scripting.
Also arrays are not the same thing as tables: call them tables. |
|
|
| Report Abuse |
|
|
|
| 08 Apr 2012 09:09 PM |
Oh sorry about posting it in the wrong place. I don't use the forums alot sorry about that.
Okay Ill try that, Thanks for your help :) |
|
|
| Report Abuse |
|
|
Quenty
|
  |
| Joined: 03 Sep 2009 |
| Total Posts: 9316 |
|
| |
|
|
| 08 Apr 2012 11:29 PM |
table.sort will do it. I didn't know about ipairs. Thanks Quenty :3 |
|
|
| Report Abuse |
|
|
smurf279
|
  |
| Joined: 15 Mar 2010 |
| Total Posts: 6871 |
|
|
| 09 Apr 2012 12:24 AM |
| @Quenty; he means the values not (plural for of index[idencies?]) |
|
|
| Report Abuse |
|
|
|
| 09 Apr 2012 12:28 AM |
There should be an array library with an array.sort function.
Nah, kidding. |
|
|
| Report Abuse |
|
|