bool LuaConstEngine::PushEntries(lua_State* L) { LuaPushNamedString(L, "version" , SpringVersion::GetSync() ); LuaPushNamedString(L, "versionFull" , (!CLuaHandle::GetHandleSynced(L))? SpringVersion::GetFull() : ""); LuaPushNamedString(L, "versionPatchSet", (!CLuaHandle::GetHandleSynced(L))? SpringVersion::GetPatchSet() : ""); LuaPushNamedString(L, "buildFlags" , (!CLuaHandle::GetHandleSynced(L))? SpringVersion::GetAdditional(): ""); #if 0 LuaPushNamedNumber(L, "nativeWordSize", (!CLuaHandle::GetHandleSynced(L))? Platform::NativeWordSize() * 8: 0); // engine LuaPushNamedNumber(L, "systemWordSize", (!CLuaHandle::GetHandleSynced(L))? Platform::SystemWordSize() * 8: 0); // op-sys #else LuaPushNamedNumber(L, "wordSize", (!CLuaHandle::GetHandleSynced(L))? Platform::NativeWordSize() * 8: 0); #endif return true; }
bool LuaFonts::CreateMetatable(lua_State* L) { luaL_newmetatable(L, "Font"); HSTR_PUSH_CFUNC(L, "__gc", meta_gc); HSTR_PUSH_CFUNC(L, "__index", meta_index); LuaPushNamedString(L, "__metatable", "protected metatable"); //! push userdata callouts REGISTER_LUA_CFUNC(Print); REGISTER_LUA_CFUNC(Begin); REGISTER_LUA_CFUNC(End); REGISTER_LUA_CFUNC(WrapText); REGISTER_LUA_CFUNC(GetTextWidth); REGISTER_LUA_CFUNC(GetTextHeight); REGISTER_LUA_CFUNC(SetTextColor); REGISTER_LUA_CFUNC(SetOutlineColor); REGISTER_LUA_CFUNC(SetAutoOutlineColor); REGISTER_LUA_CFUNC(BindTexture); lua_pop(L, 1); return true; }
bool LuaLobby::CreateMetatable(lua_State* L) { luaL_newmetatable(L, "LuaLobby"); HSTR_PUSH_CFUNC(L, "__gc", meta_gc); HSTR_PUSH_CFUNC(L, "__index", meta_index); HSTR_PUSH_CFUNC(L, "__newindex", meta_newindex); LuaPushNamedString(L, "__metatable", "protected metatable"); REGISTER_LUA_CFUNC(Poll); REGISTER_LUA_CFUNC(Connect); REGISTER_LUA_CFUNC(Disconnect); REGISTER_LUA_CFUNC(Register); REGISTER_LUA_CFUNC(Login); REGISTER_LUA_CFUNC(ConfirmAggreement); REGISTER_LUA_CFUNC(Rename); REGISTER_LUA_CFUNC(ChangePass); REGISTER_LUA_CFUNC(StatusUpdate); REGISTER_LUA_CFUNC(Channels); REGISTER_LUA_CFUNC(RequestMutelist); REGISTER_LUA_CFUNC(JoinChannel); REGISTER_LUA_CFUNC(LeaveChannel); REGISTER_LUA_CFUNC(KickChannelMember); REGISTER_LUA_CFUNC(ChangeTopic); REGISTER_LUA_CFUNC(Say); REGISTER_LUA_CFUNC(SayEx); REGISTER_LUA_CFUNC(SayPrivate); lua_pop(L, 1); return true; }
static int ModelTable(lua_State* L, const void* data) { const UnitDef* ud = static_cast<const UnitDef*>(data); const std::string modelFile = modelParser->FindModelPath(ud->modelName); lua_newtable(L); HSTR_PUSH_STRING(L, "type", StringToLower(FileSystem::GetExtension(modelFile))); HSTR_PUSH_STRING(L, "path", modelFile); HSTR_PUSH_STRING(L, "name", ud->modelName); HSTR_PUSH(L, "textures"); lua_newtable(L); if (ud->model != NULL) { LuaPushNamedString(L, "tex1", ud->model->tex1); LuaPushNamedString(L, "tex2", ud->model->tex2); } lua_rawset(L, -3); return 1; }
bool LuaConstPlatform::PushEntries(lua_State* L) { LuaPushNamedString(L, "gpu", globalRenderingInfo.gpuName); LuaPushNamedString(L, "gpuVendor", globalRenderingInfo.gpuVendor); LuaPushNamedNumber(L, "gpuMemorySize", globalRendering->gpuMemorySize); LuaPushNamedString(L, "glVersionShort", globalRenderingInfo.glVersionShort); LuaPushNamedString(L, "glslVersionShort", globalRenderingInfo.glslVersionShort); LuaPushNamedString(L, "glVersion", globalRenderingInfo.glVersion); LuaPushNamedString(L, "glVendor", globalRenderingInfo.glVendor); LuaPushNamedString(L, "glRenderer", globalRenderingInfo.glRenderer); LuaPushNamedString(L, "glslVersion", globalRenderingInfo.glslVersion); LuaPushNamedString(L, "glewVersion", globalRenderingInfo.glewVersion); LuaPushNamedNumber(L, "sdlVersionCompiledMajor", globalRenderingInfo.sdlVersionCompiled.major); LuaPushNamedNumber(L, "sdlVersionCompiledMinor", globalRenderingInfo.sdlVersionCompiled.minor); LuaPushNamedNumber(L, "sdlVersionCompiledPatch", globalRenderingInfo.sdlVersionCompiled.patch); LuaPushNamedNumber(L, "sdlVersionLinkedMajor", globalRenderingInfo.sdlVersionLinked.major); LuaPushNamedNumber(L, "sdlVersionLinkedMinor", globalRenderingInfo.sdlVersionLinked.minor); LuaPushNamedNumber(L, "sdlVersionLinkedPatch", globalRenderingInfo.sdlVersionLinked.patch); LuaPushNamedBool(L, "glSupportNonPowerOfTwoTex", globalRendering->supportNonPowerOfTwoTex); LuaPushNamedBool(L, "glSupportTextureQueryLOD" , globalRendering->supportTextureQueryLOD); LuaPushNamedBool(L, "glSupport24bitDepthBuffer", globalRendering->support24bitDepthBuffer); LuaPushNamedBool(L, "glSupportRestartPrimitive", globalRendering->supportRestartPrimitive); LuaPushNamedBool(L, "glSupportClipSpaceControl", globalRendering->supportClipSpaceControl); LuaPushNamedBool(L, "glSupportFragDepthLayout" , globalRendering->supportFragDepthLayout); LuaPushNamedString(L, "osName", Platform::GetOS()); LuaPushNamedString(L, "osFamily", Platform::GetOSFamily()); return true; }
bool LuaConstGame::PushEntries(lua_State* L) { // FIXME -- this is getting silly, convert to userdata? const float gravity = -(mapInfo->map.gravity * GAME_SPEED * GAME_SPEED); const bool limitDGun = gameSetup ? gameSetup->limitDgun : false; const bool diminishingMMs = gameSetup ? gameSetup->diminishingMMs : false; const bool ghostedBuildings = gameSetup ? gameSetup->ghostedBuildings : false; const int startPosType = gameSetup ? gameSetup->startPosType : 0; // FIXME -- loaded too early - not set yet (another reason to use userdata) lua_pushliteral(L, "gameID"); lua_pushlstring(L, (const char*)game->gameID, sizeof(game->gameID)); lua_rawset(L, -3); LuaPushNamedString(L, "version", SpringVersion::GetFull()); LuaPushNamedNumber(L, "maxUnits", uh->MaxUnits()); LuaPushNamedNumber(L, "maxTeams", MAX_TEAMS); LuaPushNamedNumber(L, "maxPlayers", MAX_PLAYERS); LuaPushNamedNumber(L, "gameSpeed", GAME_SPEED); LuaPushNamedNumber(L, "squareSize", SQUARE_SIZE); LuaPushNamedNumber(L, "gameMode", gameSetup->gameMode); LuaPushNamedNumber(L, "startPosType", startPosType); LuaPushNamedBool(L, "commEnds", (gameSetup->gameMode >= 1)); LuaPushNamedBool(L, "limitDGun", limitDGun); LuaPushNamedBool(L, "diminishingMetal", diminishingMMs); LuaPushNamedBool(L, "ghostedBuildings", ghostedBuildings); const CMapInfo* mi = mapInfo; LuaPushNamedBool(L, "mapDamage", !mapDamage->disabled); LuaPushNamedNumber(L, "gravity", gravity); LuaPushNamedNumber(L, "windMin", wind.GetMinWind()); LuaPushNamedNumber(L, "windMax", wind.GetMaxWind()); LuaPushNamedString(L, "mapName", mi->map.name); LuaPushNamedString(L, "mapHumanName", mi->map.humanName); LuaPushNamedNumber(L, "mapX", readmap->width / 64); LuaPushNamedNumber(L, "mapY", readmap->height / 64); LuaPushNamedNumber(L, "mapSizeX", readmap->width * SQUARE_SIZE); LuaPushNamedNumber(L, "mapSizeZ", readmap->height * SQUARE_SIZE); LuaPushNamedNumber(L, "extractorRadius", mi->map.extractorRadius); LuaPushNamedNumber(L, "tidal", mi->map.tidalStrength); LuaPushNamedNumber(L, "waterDamage", mi->water.damage); LuaPushNamedString(L, "waterTexture", mi->water.texture); LuaPushNamedNumber(L, "waterRepeatX", mi->water.repeatX); LuaPushNamedNumber(L, "waterRepeatY", mi->water.repeatY); LuaPushNamedString(L, "waterFoamTexture", mi->water.foamTexture); LuaPushNamedString(L, "waterNormalTexture", mi->water.normalTexture); LuaPushNamedNumber(L, "waterNumTiles", mi->water.numTiles); LuaPushNamedBool(L, "waterVoid", mi->map.voidWater); LuaPushNamedBool(L, "waterHasWaterPlane", mi->water.hasWaterPlane); LuaPushNamedBool(L, "waterForceRendering", mi->water.forceRendering); LuaPushNamedColor(L, "waterAbsorb", mi->water.absorb); LuaPushNamedColor(L, "waterBaseColor", mi->water.baseColor); LuaPushNamedColor(L, "waterMinColor", mi->water.minColor); LuaPushNamedColor(L, "waterSurfaceColor", mi->water.surfaceColor); LuaPushNamedNumber(L, "waterSurfaceAlpha", mi->water.surfaceAlpha); LuaPushNamedColor(L, "waterDiffuseColor", mi->water.diffuseColor); LuaPushNamedNumber(L, "waterDiffuseFactor", mi->water.diffuseFactor); LuaPushNamedColor(L, "waterSpecularColor", mi->water.specularColor); LuaPushNamedNumber(L, "waterSpecularFactor", mi->water.specularFactor); LuaPushNamedNumber(L, "waterAmbientFactor", mi->water.ambientFactor); LuaPushNamedColor(L, "waterPlaneColor", mi->water.planeColor); LuaPushNamedNumber(L, "waterFresnelMin", mi->water.fresnelMin); LuaPushNamedNumber(L, "waterFresnelMax", mi->water.fresnelMax); LuaPushNamedNumber(L, "waterFresnelPower", mi->water.fresnelPower); LuaPushNamedNumber(L, "waterReflectionDistortion", mi->water.reflDistortion); LuaPushNamedColor(L, "fogColor", mi->atmosphere.fogColor); LuaPushNamedColor(L, "groundAmbientColor", mi->light.groundAmbientColor); LuaPushNamedColor(L, "groundSpecularColor", mi->light.groundSpecularColor); LuaPushNamedColor(L, "groundSunColor", mi->light.groundSunColor); const vector<string>& causticTexs = mi->water.causticTextures; lua_pushstring(L, "waterCausticTextures"); lua_newtable(L); for (int i = 0; i < (int)causticTexs.size(); i++) { lua_pushnumber(L, i + 1); lua_pushstring(L, causticTexs[i].c_str()); lua_rawset(L, -3); } lua_rawset(L, -3); LuaPushNamedString(L, "modName", modInfo.humanName); LuaPushNamedString(L, "modShortName", modInfo.shortName); LuaPushNamedString(L, "modVersion", modInfo.version); LuaPushNamedString(L, "modMutator", modInfo.mutator); LuaPushNamedString(L, "modDesc", modInfo.description); LuaPushNamedBool(L, "allowTeamColors", modInfo.allowTeamColors); LuaPushNamedBool(L, "constructionDecay", modInfo.constructionDecay); LuaPushNamedNumber(L, "constructionDecayTime", modInfo.constructionDecayTime); LuaPushNamedNumber(L, "constructionDecaySpeed", modInfo.constructionDecaySpeed); LuaPushNamedNumber(L, "multiReclaim", modInfo.multiReclaim); LuaPushNamedNumber(L, "reclaimMethod", modInfo.reclaimMethod); LuaPushNamedNumber(L, "reclaimUnitMethod", modInfo.reclaimUnitMethod); LuaPushNamedNumber(L, "reclaimUnitEnergyCostFactor", modInfo.reclaimUnitEnergyCostFactor); LuaPushNamedNumber(L, "reclaimUnitEfficiency", modInfo.reclaimUnitEfficiency); LuaPushNamedNumber(L, "reclaimFeatureEnergyCostFactor", modInfo.reclaimFeatureEnergyCostFactor); LuaPushNamedBool(L, "reclaimAllowEnemies", modInfo.reclaimAllowEnemies); LuaPushNamedBool(L, "reclaimAllowAllies", modInfo.reclaimAllowAllies); LuaPushNamedNumber(L, "repairEnergyCostFactor", modInfo.repairEnergyCostFactor); LuaPushNamedNumber(L, "resurrectEnergyCostFactor", modInfo.resurrectEnergyCostFactor); LuaPushNamedNumber(L, "captureEnergyCostFactor", modInfo.captureEnergyCostFactor); LuaPushNamedNumber(L, "transportAir", modInfo.transportAir); LuaPushNamedNumber(L, "transportShip", modInfo.transportShip); LuaPushNamedNumber(L, "transportHover", modInfo.transportHover); LuaPushNamedNumber(L, "transportGround", modInfo.transportGround); LuaPushNamedNumber(L, "fireAtKilled", modInfo.fireAtKilled); LuaPushNamedNumber(L, "fireAtCrashing", modInfo.fireAtCrashing); LuaPushNamedNumber(L, "requireSonarUnderWater", modInfo.requireSonarUnderWater); char buf[64]; SNPRINTF(buf, sizeof(buf), "0x%08X", archiveScanner->GetArchiveCompleteChecksum(mapInfo->map.name)); LuaPushNamedString(L, "mapChecksum", buf); SNPRINTF(buf, sizeof(buf), "0x%08X", archiveScanner->GetArchiveCompleteChecksum(modInfo.filename)); LuaPushNamedString(L, "modChecksum", buf); const vector<string> cats = CCategoryHandler::Instance()->GetCategoryNames(~0); lua_pushstring(L, "springCategories"); lua_newtable(L); for (int i = 0; i < (int)cats.size(); i++) { LuaPushNamedNumber(L, StringToLower(cats[i]), i); } lua_rawset(L, -3); lua_pushstring(L, "armorTypes"); lua_newtable(L); const std::vector<std::string>& typeList = damageArrayHandler->GetTypeList(); const int typeCount = (int)typeList.size(); for (int i = 0; i < typeCount; i++) { // bidirectional map lua_pushstring(L, typeList[i].c_str()); lua_pushnumber(L, i); lua_rawset(L, -3); lua_pushnumber(L, i); lua_pushstring(L, typeList[i].c_str()); lua_rawset(L, -3); } lua_rawset(L, -3); return true; }
bool LuaConstGame::PushEntries(lua_State* L) { assert(mapInfo); assert(gameSetup); // FIXME -- this is getting silly, convert to userdata? LuaPushNamedString(L, "version", SpringVersion::GetSync()); LuaPushNamedString(L, "buildFlags", (!CLuaHandle::GetHandleSynced(L))? SpringVersion::GetAdditional(): ""); if (unitHandler != NULL) { LuaPushNamedNumber(L, "maxUnits", unitHandler->MaxUnits()); } LuaPushNamedNumber(L, "maxTeams", MAX_TEAMS); LuaPushNamedNumber(L, "maxPlayers", MAX_PLAYERS); LuaPushNamedNumber(L, "gameSpeed", GAME_SPEED); LuaPushNamedNumber(L, "squareSize", SQUARE_SIZE); LuaPushNamedNumber(L, "startPosType", gameSetup->startPosType); LuaPushNamedBool(L, "ghostedBuildings", gameSetup->ghostedBuildings); LuaPushNamedNumber(L, "gravity", -mapInfo->map.gravity * GAME_SPEED * GAME_SPEED); LuaPushNamedNumber(L, "windMin", wind.GetMinWind()); LuaPushNamedNumber(L, "windMax", wind.GetMaxWind()); LuaPushNamedString(L, "mapName", mapInfo->map.name); LuaPushNamedString(L, "mapHumanName", mapInfo->map.description); //! deprecated LuaPushNamedString(L, "mapDescription", mapInfo->map.description); LuaPushNamedNumber(L, "mapHardness", mapInfo->map.hardness); if (mapDamage) { // damage is enabled iff !mapInfo->map.notDeformable LuaPushNamedBool(L, "mapDamage", !mapDamage->disabled); } if (readmap) { //FIXME make this available in LoadScreen already! LuaPushNamedNumber(L, "mapX", readmap->width / 64); LuaPushNamedNumber(L, "mapY", readmap->height / 64); LuaPushNamedNumber(L, "mapSizeX", readmap->width * SQUARE_SIZE); LuaPushNamedNumber(L, "mapSizeZ", readmap->height * SQUARE_SIZE); } LuaPushNamedNumber(L, "extractorRadius", mapInfo->map.extractorRadius); LuaPushNamedNumber(L, "tidal", mapInfo->map.tidalStrength); LuaPushNamedNumber(L, "waterDamage", mapInfo->water.damage); LuaPushNamedString(L, "waterTexture", mapInfo->water.texture); LuaPushNamedNumber(L, "waterRepeatX", mapInfo->water.repeatX); LuaPushNamedNumber(L, "waterRepeatY", mapInfo->water.repeatY); LuaPushNamedString(L, "waterFoamTexture", mapInfo->water.foamTexture); LuaPushNamedString(L, "waterNormalTexture", mapInfo->water.normalTexture); LuaPushNamedNumber(L, "waterNumTiles", mapInfo->water.numTiles); LuaPushNamedBool(L, "voidWater", mapInfo->map.voidWater); LuaPushNamedBool(L, "voidGround", mapInfo->map.voidGround); LuaPushNamedBool(L, "waterHasWaterPlane", mapInfo->water.hasWaterPlane); LuaPushNamedBool(L, "waterForceRendering", mapInfo->water.forceRendering); LuaPushNamedColor(L, "waterAbsorb", mapInfo->water.absorb); LuaPushNamedColor(L, "waterBaseColor", mapInfo->water.baseColor); LuaPushNamedColor(L, "waterMinColor", mapInfo->water.minColor); LuaPushNamedColor(L, "waterSurfaceColor", mapInfo->water.surfaceColor); LuaPushNamedNumber(L, "waterSurfaceAlpha", mapInfo->water.surfaceAlpha); LuaPushNamedColor(L, "waterDiffuseColor", mapInfo->water.diffuseColor); LuaPushNamedNumber(L, "waterDiffuseFactor", mapInfo->water.diffuseFactor); LuaPushNamedColor(L, "waterSpecularColor", mapInfo->water.specularColor); LuaPushNamedNumber(L, "waterSpecularFactor", mapInfo->water.specularFactor); LuaPushNamedNumber(L, "waterAmbientFactor", mapInfo->water.ambientFactor); LuaPushNamedColor(L, "waterPlaneColor", mapInfo->water.planeColor); LuaPushNamedNumber(L, "waterFresnelMin", mapInfo->water.fresnelMin); LuaPushNamedNumber(L, "waterFresnelMax", mapInfo->water.fresnelMax); LuaPushNamedNumber(L, "waterFresnelPower", mapInfo->water.fresnelPower); LuaPushNamedNumber(L, "waterReflectionDistortion", mapInfo->water.reflDistortion); LuaPushNamedColor(L, "fogColor", mapInfo->atmosphere.fogColor); LuaPushNamedColor(L, "groundAmbientColor", mapInfo->light.groundAmbientColor); LuaPushNamedColor(L, "groundSpecularColor", mapInfo->light.groundSpecularColor); LuaPushNamedColor(L, "groundSunColor", mapInfo->light.groundSunColor); const vector<string>& causticTexs = mapInfo->water.causticTextures; lua_pushliteral(L, "waterCausticTextures"); lua_newtable(L); for (int i = 0; i < (int)causticTexs.size(); i++) { lua_pushnumber(L, i + 1); lua_pushsstring(L, causticTexs[i]); lua_rawset(L, -3); } lua_rawset(L, -3); LuaPushNamedBool(L, "allowTeamColors", true); LuaPushNamedString(L, "modName", modInfo.humanName); LuaPushNamedString(L, "modShortName", modInfo.shortName); LuaPushNamedString(L, "modVersion", modInfo.version); LuaPushNamedString(L, "modMutator", modInfo.mutator); LuaPushNamedString(L, "modDesc", modInfo.description); LuaPushNamedBool(L, "constructionDecay", modInfo.constructionDecay); LuaPushNamedNumber(L, "constructionDecayTime", modInfo.constructionDecayTime); LuaPushNamedNumber(L, "constructionDecaySpeed", modInfo.constructionDecaySpeed); LuaPushNamedNumber(L, "multiReclaim", modInfo.multiReclaim); LuaPushNamedNumber(L, "reclaimMethod", modInfo.reclaimMethod); LuaPushNamedNumber(L, "reclaimUnitMethod", modInfo.reclaimUnitMethod); LuaPushNamedNumber(L, "reclaimUnitEnergyCostFactor", modInfo.reclaimUnitEnergyCostFactor); LuaPushNamedNumber(L, "reclaimUnitEfficiency", modInfo.reclaimUnitEfficiency); LuaPushNamedNumber(L, "reclaimFeatureEnergyCostFactor", modInfo.reclaimFeatureEnergyCostFactor); LuaPushNamedBool(L, "reclaimAllowEnemies", modInfo.reclaimAllowEnemies); LuaPushNamedBool(L, "reclaimAllowAllies", modInfo.reclaimAllowAllies); LuaPushNamedNumber(L, "repairEnergyCostFactor", modInfo.repairEnergyCostFactor); LuaPushNamedNumber(L, "resurrectEnergyCostFactor", modInfo.resurrectEnergyCostFactor); LuaPushNamedNumber(L, "captureEnergyCostFactor", modInfo.captureEnergyCostFactor); LuaPushNamedNumber(L, "transportAir", modInfo.transportAir); LuaPushNamedNumber(L, "transportShip", modInfo.transportShip); LuaPushNamedNumber(L, "transportHover", modInfo.transportHover); LuaPushNamedNumber(L, "transportGround", modInfo.transportGround); LuaPushNamedNumber(L, "fireAtKilled", modInfo.fireAtKilled); LuaPushNamedNumber(L, "fireAtCrashing", modInfo.fireAtCrashing); LuaPushNamedNumber(L, "requireSonarUnderWater", modInfo.requireSonarUnderWater); char buf[64]; SNPRINTF(buf, sizeof(buf), "0x%08X", archiveScanner->GetArchiveCompleteChecksum(mapInfo->map.name)); LuaPushNamedString(L, "mapChecksum", buf); SNPRINTF(buf, sizeof(buf), "0x%08X", archiveScanner->GetArchiveCompleteChecksum(modInfo.filename)); LuaPushNamedString(L, "modChecksum", buf); const vector<string> &cats = CCategoryHandler::Instance()->GetCategoryNames(~0); lua_pushliteral(L, "springCategories"); lua_newtable(L); for (int i = 0; i < (int)cats.size(); i++) { LuaPushNamedNumber(L, StringToLower(cats[i]), i); } lua_rawset(L, -3); lua_pushliteral(L, "armorTypes"); lua_newtable(L); if (damageArrayHandler) { const std::vector<std::string>& typeList = damageArrayHandler->GetTypeList(); const int typeCount = (int)typeList.size(); for (int i = 0; i < typeCount; i++) { // bidirectional map lua_pushsstring(L, typeList[i]); lua_pushnumber(L, i); lua_rawset(L, -3); lua_pushnumber(L, i); lua_pushsstring(L, typeList[i]); lua_rawset(L, -3); } } lua_rawset(L, -3); return true; }
bool LuaConstGame::PushEntries(lua_State* L) { const float gravity = -(gs->gravity * GAME_SPEED * GAME_SPEED); const bool limitDGun = gameSetup ? gameSetup->limitDgun : false; const bool diminishingMMs = gameSetup ? gameSetup->diminishingMMs : false; const int startPosType = gameSetup ? gameSetup->startPosType : 0; LuaPushNamedString(L, "version", VERSION_STRING); LuaPushNamedNumber(L, "maxUnits", MAX_UNITS); LuaPushNamedNumber(L, "maxTeams", MAX_TEAMS); LuaPushNamedNumber(L, "maxPlayers", MAX_PLAYERS); LuaPushNamedNumber(L, "gameSpeed", GAME_SPEED); LuaPushNamedNumber(L, "squareSize", SQUARE_SIZE); LuaPushNamedNumber(L, "gameMode", gs->gameMode); LuaPushNamedNumber(L, "startPosType", startPosType); LuaPushNamedBool(L, "commEnds", (gs->gameMode >= 1)); LuaPushNamedBool(L, "limitDGun", limitDGun); LuaPushNamedBool(L, "diminishingMetal", diminishingMMs); LuaPushNamedString(L, "mapName", readmap->mapName); LuaPushNamedString(L, "mapHumanName", readmap->mapHumanName); LuaPushNamedNumber(L, "mapX", readmap->width / 64); LuaPushNamedNumber(L, "mapY", readmap->height / 64); LuaPushNamedNumber(L, "gravity", gravity); LuaPushNamedNumber(L, "tidal", readmap->tidalStrength); LuaPushNamedNumber(L, "windMin", wind.minWind); LuaPushNamedNumber(L, "windMax", wind.maxWind); LuaPushNamedBool(L, "mapDamage", !mapDamage->disabled); LuaPushNamedBool(L, "mapWaterVoid", readmap->voidWater); LuaPushNamedBool(L, "mapWaterPlane", readmap->hasWaterPlane); LuaPushNamedString(L, "modName", modInfo->name); LuaPushNamedString(L, "modHumanName", modInfo->humanName); LuaPushNamedBool(L, "allowTeamColors", modInfo->allowTeamColors); LuaPushNamedNumber(L, "multiReclaim", modInfo->multiReclaim); LuaPushNamedNumber(L, "reclaimMethod", modInfo->reclaimMethod); LuaPushNamedNumber(L, "transportAir", modInfo->transportAir); LuaPushNamedNumber(L, "transportShip", modInfo->transportShip); LuaPushNamedNumber(L, "transportHover", modInfo->transportHover); LuaPushNamedNumber(L, "transportGround", modInfo->transportGround); char buf[64]; SNPRINTF(buf, sizeof(buf), "0x%08X", archiveScanner->GetMapChecksum(readmap->mapName)); LuaPushNamedString(L, "mapChecksum", buf); SNPRINTF(buf, sizeof(buf), "0x%08X", archiveScanner->GetModChecksum(modInfo->name)); LuaPushNamedString(L, "modChecksum", buf); const vector<string> cats = CCategoryHandler::Instance()->GetCategoryNames(~0); lua_pushstring(L, "springCategories"); lua_newtable(L); for (int i = 0; i < (int)cats.size(); i++) { LuaPushNamedBool(L, cats[i], true); } lua_rawset(L, -3); lua_pushstring(L, "armorTypes"); lua_newtable(L); const std::vector<std::string>& typeList = damageArrayHandler->typeList; const int typeCount = (int)typeList.size(); for (int i = 0; i < typeCount; i++) { LuaPushNamedNumber(L, typeList[i].c_str(), i); } lua_rawset(L, -3); return true; }