Skip to content

Instantly share code, notes, and snippets.

@a-suenami
Created February 23, 2012 02:49
Show Gist options
  • Save a-suenami/1889435 to your computer and use it in GitHub Desktop.
Save a-suenami/1889435 to your computer and use it in GitHub Desktop.
sorting program with Lua.
data = {2, 32, 12, 0, 493, 4, 5, 32}
for i = 1, #data do
for j = i + 1, #data do
if data[i] >= data[j] then
tmp = data[i]
data[i] = data[j]
data[j] = tmp
end
end
end
for key, val in pairs(data) do
print('data['..key..'] = '..val)
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment