下のキーワードは予約されており、名前(変数名)としては使えません。
当然、
コメントやprint文の中では使用可能です。
and break do else elseif
end false for function if
in local nil not or
repeat return then true until while
また、Luaridaで拡張されたコマンドも使用できません。
実行時のエラーのサンプルです。
予約語の「and」を変数として使用してみました。
------------------------------------------
-- 予約語エラーのサンプル ReservedWord_Error_sample.lua
------------------------------------------
function main()
and = 1 -- 予約語を変数に使用
canvas.drawCls(color(255,255,255))
canvas.drawText("予約語エラーのサンプル", 0, 0, 24, color(255,0,0))
canvas.drawText("画面タッチで終了します", 0,120, 24, color(0,0,0))
touch(3)
end
main()
1.予約語エラーのサンプルの実行結果です。
2.Luaridaの予約後を使用したサンプルです。上記スクリプトの6行目の「and」を「touch」に変更した実行結果です。
コメント(最大10行)
最終更新:2012年04月22日 09:00