webvm/examples/lua/sorting.lua

14 lines
206 B
Lua
Raw Normal View History

#!/usr/bin/env luajit
2022-01-31 20:52:13 +00:00
fruits = {"banana","orange","apple","grapes"}
for k,v in ipairs(fruits) do
print(k,v)
end
table.sort(fruits)
print("sorted table")
for k,v in ipairs(fruits) do
print(k,v)
end