|
| 28 Jul 2014 08:15 PM |
how do I use table.sort properly?
my example real lua code: local stupid_people = {"you"};local smart_people = {"me"};for i,v in pairs(stupid_people) do print("stupid people: "..stupid_people[math.random(1,#stupid_people)]);end;for i,v in pairs(smart_people) do print("cool & smart people: "..smart_people[math.random(1,#smart_people)]);end;print(2 + 2);if 2 + 2 == 5 then print("2+2=5");end;if 2 + 2 == 4 then print("2+2=4");end;table.insert(smart_people, "swiggity swag");print(smart_people[2]);if smart_people[2] == "swiggity swag" then print(" O_O ");end |
|
|
| Report Abuse |
|
|
cntkillme
|
  |
| Joined: 07 Apr 2008 |
| Total Posts: 44956 |
|
|
| 28 Jul 2014 08:24 PM |
What's with the random code? Whatever: http://www.lua.org/pil/19.3.html |
|
|
| Report Abuse |
|
|
|
| 28 Jul 2014 08:53 PM |
wow, here it is simplified and not all messy:
local stupid_people = {"you"} local smart_people = {"me"} for i,v in pairs(stupid_people) do print("stupid people: "..stupid_people[math.random(1,#stupid_people)]) end for i,v in pairs(smart_people) do print("cool & smart people: "..smart_people[math.random(1,#smart_people)]) end print(2 + 2) if 2 + 2 == 5 then print("2+2=5") end if 2 + 2 == 4 then print("2+2=4") end table.insert(smart_people, "swiggity swag") print(smart_people[2]) if smart_people[2] == "swiggity swag" then print(" O_O ") end |
|
|
| Report Abuse |
|
|
|
| 28 Jul 2014 08:56 PM |
| @cntkillme: He is a troll, so you can ignore him. |
|
|
| Report Abuse |
|
|