Nspire の組込函数を Lua で使う(5)
function on.paint(gc) -- newMat() だとすべての element に 0 が代入されるが、constructMat() を使えば何らかの数列で入力できる。loop を使わずに済む。 local mat = math.eval("constructMat(i*10+j, i, j, 65, 47)") -- 確認のためテーブルの内容を表示してみる for i = 1, #mat do for j = 1, #mat[1] do --gc:setColorRGB(i*j/3, j * 7, i * 15) gc:drawString(mat[i][j], j * 29, i * 14) end end end