// ///////////////////////////////////////////////////////////////// // // ///////////////////////////////////////////////////////////////// bool BallActorParams::VInit(LuaPlus::LuaObject srcData, TErrorMessageList &errorMessages) { if (!Pool3dActorParams::VInit(srcData, errorMessages)) { return (false); } VSetType(AT_Ball); LuaPlus::LuaObject rObj = srcData["Radius"]; if(rObj.IsNumber()) { m_radius = static_cast<F32>(rObj.GetNumber()); } LuaPlus::LuaObject slObj = srcData["Slices"]; if(slObj.IsInteger()) { m_slices = slObj.GetInteger(); } LuaPlus::LuaObject stObj = srcData["Stacks"]; if(stObj.IsInteger()) { m_stacks = stObj.GetInteger(); } LuaPlus::LuaObject groupObj = srcData["Group"]; if(groupObj.IsString()) { const char *groupStr = groupObj.GetString(); if(strcmp(groupStr, "cue") == 0) { m_group = eCue; } else if(strcmp(groupStr, "stripes") == 0) { m_group = eStripes; } else if(strcmp(groupStr, "plain") == 0) { m_group = ePlain; } else if(strcmp(groupStr, "black") == 0) { m_group = eBlack; } else { m_group = eCue; } } return (true); }
bool EvtData_StartJump::buildEventFromScript(void) { if (m_eventData.IsTable()) { // ID LuaPlus::LuaObject temp = m_eventData.GetByName("actorId"); if (temp.IsInteger()) { m_id = temp.GetInteger(); } else { GCC_ERROR("Invalid id sent to EvtData_StartJump; type = " + std::string(temp.TypeName())); return false; } // acceleration temp = m_eventData.GetByName("acceleration"); if (temp.IsNumber()) m_acceleration = temp.GetFloat(); else m_acceleration = 5.0f; // something reasonable return true; } return false; }
// ///////////////////////////////////////////////////////////////// // // ///////////////////////////////////////////////////////////////// bool SetIntFromLua(const LuaPlus::LuaObject &numberData, I32 &number) { if(!numberData.IsInteger()) { return (false); } number = numberData.GetInteger(); return (true); }
bool EvtData_EndAccelerating::buildEventFromScript(void) { if (m_eventData.IsTable()) { // ID LuaPlus::LuaObject temp = m_eventData.GetByName("id"); if (temp.IsInteger()) { m_id = temp.GetInteger(); } else { GCC_ERROR("Invalid id sent to EvtData_EndAccelerating; type = " + std::string(temp.TypeName())); return false; } return true; } return false; }
// ///////////////////////////////////////////////////////////////// // // ///////////////////////////////////////////////////////////////// void SliderControl::SetLuaEventId(const LuaPlus::LuaObject &table) { if(table.IsInteger()) { m_eventTypeId = table.GetInteger(); } }