26 posts
Posted 03 October 2014 - 07:35 AM
I'm having real problems with sorting numbers and stuff with lua… Is there any way to like sort 4 numbers that is in the same variable from highest to lowest… Like 9826 to 9862 and vice versa? :D/>
7508 posts
Location
Australia
Posted 03 October 2014 - 07:44 AM
Can we see the code that you've tried so far, and what these 'real problems' are that you've been having with them? that way we can give you better advice for your specific problem.
26 posts
Posted 03 October 2014 - 02:49 PM
I haven't really started on anything with that yet… It's just a fun idea I got from this vid:
https://www.youtube.com/watch?v=d8TRcZklX_QI thought that I could make some fun generator with this to test numbers…
To do that one have to sort the numbers in falling order and subtract the opposite, like this example:
input: 6548
computation: 8654 - 4568
7508 posts
Location
Australia
Posted 03 October 2014 - 02:52 PM
okay, well you'll want to take a look into
tables. you can then make use of the
table.sort function which will sort the values within the table
26 posts
Posted 03 October 2014 - 11:06 PM
Nice, I've been reading the online lua book thingy and when you say it, I remember that I've read about that sort function! Thanks alot!