スクリプト言語

Last-modified: 2007-06-04 (月) 12:40:00

国内人気
Ruby>=Python>>>Lua>|超えられない壁|>>>>AngelScript

テキスト処理能力
Python≒Ruby>>>>|超えられない壁|>>>>AngelScript

・ゲームのイベント記述程度ならAngelScriptのほうが手軽で良いのでは無いか
・Rubyはライブラリ量の面、JITが実験段階ということで、Pythonに劣る
・逆にPythonは大きすぎるという理由で組み込みスクリプトには不向き。
・Luaはスタック操作や似非クラスのおかげで直感的でない
・AngelScriptはクラス利用が可能

 (オブジェクト指向言語としての機能が揃っているかどうかは不明だが、
  C++のオブジェクトをそのまま扱うことができる)

型付け(強弱については、人によって見方が異なるので書かないことにした)
Python 動的
Ruby 動的
Lua 動的
Angel 静的

以下は、AngelScriptのsampleに含まれているソースである。
C/C++とほとんど変わりの無い構文であることがわかる。
ちなみに、クラス定義にはメソッドを含むことも可能。

class ThreadArg
{
 int count;
 string str;
};
void main()
{
     for(;;)
     {
	int count = 10;
	ThreadArg a;
	a.count = 3;
	a.str = " B";
	CreateCoRoutine("thread2", any(@a));
	while( count-- > 0 )
	{
	  Print("A :" + count + "\n");
	  Yield();
	}
     }

}

void thread2(any &in arg)
{
     ThreadArg @a;
     arg.retrieve(@a);
     int count = a.count;
     string str = a.str;
     while( count-- > 0 )
     {
      Print(str + ":" + count + "\n");
      Yield();
     }
}