MoonScript实现选择排序

作者:糖果

LUA代码:

list = {1,5,3,2,9,3,6}
len=#list

for i=1,len 
  max = list[i]
  for j=i+1, len do  
    if list[j]>max then 
      tmp=list[j] 
      list[j]=max
      list[i]=tmp
      max=tmp

for item in *list
  print(item)

MoonScript代码

local list = { 
  1,  
  5,  
  3,  
  2,  
  9,  
  3,  
  6
}
local len = #list
for i = 1, len do
  local max = list[i]
  for j = i + 1, len do
    if list[j] > max then
      local tmp = list[j]
      list[j] = max 
      list[i] = tmp 
      max = tmp 
    end 
  end 
end
for _index_0 = 1, #list do
  local item = list[_index_0]
  print(item)
end

糖果

糖果
LUA从入门到放弃

Moonscript如何显示复选框

Moonscript如何显示复选框 Continue reading

Lapis框架的常用处理方法

Published on March 02, 2017