luabindのメモ書き2とQtインストール

luabindでluaスクリプトからテーブルを関数の引数として受け取る方法
C++側の関数の引数には luabind::object 型の変数を設定して、


SDL_Rect drawRect = {0, 0, 0, 0};
if(luabind::type(rect) != LUA_TTABLE)return;
if(luabind::type(rect["x"]) == LUA_TNUMBER){drawRect.x = luabind::object_cast<Sint16>(rect["x"]);}
if(luabind::type(rect["y"]) == LUA_TNUMBER){drawRect.y = luabind::object_cast<Sint16>(rect["y"]);}
if(luabind::type(rect["w"]) == LUA_TNUMBER){drawRect.w = luabind::object_cast<Uint16>(rect["w"]);}
if(luabind::type(rect["h"]) == LUA_TNUMBER){drawRect.h = luabind::object_cast<Uint16>(rect["h"]);}

こんなかんじでテーブルのメンバを取得する。
型チェックが要らないなら、drawRect.x = luabind::object_cast(rect[“x”]);だけでもOK。

QTのインストール
Building Qt on Windows (MinGW)を見てインストール中。
makeではなく、mingw32-makeを使うらしい。