void LuaManager::ConvertVec3ToTable(const XMFLOAT3& vec, LuaPlus::LuaObject& outLuaTable) const { outLuaTable.AssignNewTable(GetLuaState()); outLuaTable.SetNumber("x", vec.x); outLuaTable.SetNumber("y", vec.y); outLuaTable.SetNumber("z", vec.z); }
LuaPlus::LuaObject InternalScriptExports::GetVectorFromRotation(float angleRadians) { Vec3 result = ::GetVectorFromYRotation(angleRadians); LuaPlus::LuaObject luaResult; luaResult.AssignNewTable(LuaStateManager::Get()->GetLuaState()); luaResult.SetNumber("x", result.x); luaResult.SetNumber("y", result.y); luaResult.SetNumber("z", result.z); return luaResult; }
static LuaPlus::LuaObject Wrap(Vec3 vector){ LuaPlus::LuaObject vecObj; vecObj.AssignNewTable(LuaManager::Get()->GetState()); vecObj.SetNumber("x", vector.x); vecObj.SetNumber("y", vector.y); vecObj.SetNumber("z", vector.z); return vecObj; }
static LuaPlus::LuaObject Wrap(Quat quat){ LuaPlus::LuaObject quatObj; quatObj.AssignNewTable(LuaManager::Get()->GetState()); quatObj.SetNumber("w", quat.w); quatObj.SetNumber("x", quat.x); quatObj.SetNumber("y", quat.y); quatObj.SetNumber("z", quat.z); return quatObj; }
// create a lua vec3 table from an angle in radians LuaPlus::LuaObject LuaInternalScriptExports::GetVectorFromRotation(float angleRadians) { // use the GetVectorFromYRotation from math.h Vec3 result = ::GetVectorFromYRotation(angleRadians); // create a lua vec3 table from the result LuaPlus::LuaObject luaResult; luaResult.AssignNewTable(LuaStateManager::Get()->GetLuaState()); luaResult.SetNumber("x", result.x); luaResult.SetNumber("y", result.y); luaResult.SetNumber("z", result.z); return luaResult; }
// ///////////////////////////////////////////////////////////////// // // ///////////////////////////////////////////////////////////////// LuaPlus::LuaObject SliderControl::VGetLuaData() { LuaPlus::LuaObject table; table.AssignNewTable(g_appPtr->GetLuaStateManager()->GetGlobalState().Get()); table.SetNumber("SliderPosition", m_sliderPos); table.SetInteger("EventTypeId", m_eventTypeId); table.SetInteger("ScreenElementId", VGetId()); return (table); }
//--------------------------------------------------------------------------------------------------------------------- // This function is called to register an event type with the script to link them. The simplest way to do this is // with the REGISTER_SCRIPT_EVENT() macro, which calls this function. //--------------------------------------------------------------------------------------------------------------------- void ScriptEvent::RegisterEventTypeWithScript(const char* key, EventType type) { // get or create the EventType table LuaPlus::LuaObject eventTypeTable = LuaStateManager::Get()->GetGlobalVars().GetByName("EventType"); if (eventTypeTable.IsNil()) eventTypeTable = LuaStateManager::Get()->GetGlobalVars().CreateTable("EventType"); // error checking GCC_ASSERT(eventTypeTable.IsTable()); GCC_ASSERT(eventTypeTable[key].IsNil()); // add the entry eventTypeTable.SetNumber(key, (double)type); }
void LuaScriptEventManager::RegisterEventTransformer(LuaScriptEventTransformation transformer, EventType type, LPCSTR name) { LuaScript* luas = (LuaScript*)chimera::g_pApp->GetScript(); LuaPlus::LuaObject table = luas->GetState()->GetGlobals().GetByName("EventType"); if(table.IsNil()) { table = luas->GetState()->GetGlobals().CreateTable("EventType"); } table.SetNumber(name, type); m_transformMap[type] = transformer; }
void ant::LuaStateManager::convertVec2ToTable(const sf::Vector2f& vec, LuaPlus::LuaObject& vec2Table) { vec2Table.AssignNewTable(getLuaState()); vec2Table.SetNumber("x", vec.x); vec2Table.SetNumber("y", vec.y); }