Programming in Lua(Thrid Edition)笔记---10 Complete Examples Veröffentlicht am 2015-09-07 10 Complete Examples本章分析了三个例程:八皇后问题、单词频数统计、马尔可夫链算法,是对之前所学的应用,几乎没有新的东西,所以本章笔记较少。 用逻辑运算充当三目运算 1io.write(a[i] = j and "X" or "-", " ") 用or实现将table中新元素初始化0 1234local counter = {}for w in allwords() do counter[w] = (counter[w] or 0) + 1end