void LuaScriptComponent::RegisterScriptFunctions() { // create the meta table LuaPlus::LuaObject metaTableObj = LuaStateManager::Get()->GetGlobalVars().CreateTable(LUA_METATABLE_NAME); metaTableObj.SetObject("__index", metaTableObj); // bind functions to lua object metaTableObj.RegisterObjectDirect("GetObjectId", (LuaScriptComponent*)0, &LuaScriptComponent::GetObjectId); metaTableObj.RegisterObjectDirect("GetPos", (LuaScriptComponent*)0, &LuaScriptComponent::GetPos); metaTableObj.RegisterObjectDirect("SetPos", (LuaScriptComponent*)0, &LuaScriptComponent::SetPos); metaTableObj.RegisterObjectDirect("GetLookAt", (LuaScriptComponent*)0, &LuaScriptComponent::GetLookAt); metaTableObj.RegisterObjectDirect("GetYOrientationRadians", (LuaScriptComponent*)0, &LuaScriptComponent::GetYOrientationRadians); metaTableObj.RegisterObjectDirect("RotateY", (LuaScriptComponent*)0, &LuaScriptComponent::RotateY); metaTableObj.RegisterObjectDirect("Stop", (LuaScriptComponent*)0, &LuaScriptComponent::Stop); metaTableObj.RegisterObjectDirect("SetPosition", (LuaScriptComponent*)0, &LuaScriptComponent::SetPosition); }
void BaseScriptComponent::RegisterScriptFunctions(void) { // create the metatable LuaPlus::LuaObject metaTableObj = LuaStateManager::Get()->GetGlobalVars().CreateTable(METATABLE_NAME); metaTableObj.SetObject("__index", metaTableObj); // transform component functions metaTableObj.RegisterObjectDirect("GetActorId", (BaseScriptComponent*)0, &BaseScriptComponent::GetActorId); metaTableObj.RegisterObjectDirect("GetPos", (BaseScriptComponent*)0, &BaseScriptComponent::GetPos); metaTableObj.RegisterObjectDirect("SetPos", (BaseScriptComponent*)0, &BaseScriptComponent::SetPos); metaTableObj.RegisterObjectDirect("GetLookAt", (BaseScriptComponent*)0, &BaseScriptComponent::GetLookAt); metaTableObj.RegisterObjectDirect("GetYOrientationRadians", (BaseScriptComponent*)0, &BaseScriptComponent::GetYOrientationRadians); //metaTableObj.RegisterObjectDirect("RotateY", (BaseScriptComponent*)0, &BaseScriptComponent::RotateY); //metaTableObj.RegisterObjectDirect("Stop", (BaseScriptComponent*)0, &BaseScriptComponent::Stop); //metaTableObj.RegisterObjectDirect("SetPosition", (BaseScriptComponent*)0, &BaseScriptComponent::SetPosition); }
void TransformationComponent::RegisterScriptFunction() { LuaPlus::LuaObject metaTable = LuaManager::GetSingleton().GetGlobalVars().CreateTable("TransformationComponentMetatable"); metaTable.SetObject("__index", metaTable); //TODO -> Studente MGD //Esempio: metaTable.RegisterObjectDirect("NomeFunzioneInLua", (NomeClass*)0, Puntatore a funzione); // Esporre SetPosition // Esporre GetPosition // Esporre Translate // Esporre LookAt // Esporre Rotate // Esporre GetRotateX // Esporre GetRotateY // Esporre GetRotateZ }