# Last Created Purchase Group

Grammar — Last created purchase group
FlagsNative | Function

Returns the last purchase group created by the “Create Purchase Group” action.

Returns — int<preset::PurchaseGroup>

native int PurchaseGroupLastCreated();

Category: Story / Tech Purchase Panel / Purchase Groups

# Examples

campaigns/libertystory.sc2campaignbase.sc2data/TriggerLibs/CampaignLib.galaxy:7609

        if ((libCamp_gv_tS_TechGroupID[lv_index] != libCamp_ge_StoryTechGroup_StoryTechGroupNone) && (libCamp_gv_tS_TechGroupCategoryID[lv_index] != libCamp_ge_StoryTechCategory_StoryTechCategoryNone) && (libCamp_gv_tS_TechGroup_UI[lv_index] == c_invalidPurchaseGroupId)) {
            PurchaseGroupCreate(PlayerGroupAll(), libCamp_gv_tS_TechCategory_UI[(libCamp_gv_tS_TechGroupCategoryID[lv_index])], 1);
            libCamp_gv_tS_TechGroup_UI[lv_index] = PurchaseGroupLastCreated();
            PurchaseGroupSetNameText(PurchaseGroupLastCreated(), libCamp_gv_tS_TechGroupName[lv_index]);
        }

campaigns/libertystory.sc2campaignbase.sc2data/TriggerLibs/CampaignLib.galaxy:7610

            PurchaseGroupCreate(PlayerGroupAll(), libCamp_gv_tS_TechCategory_UI[(libCamp_gv_tS_TechGroupCategoryID[lv_index])], 1);
            libCamp_gv_tS_TechGroup_UI[lv_index] = PurchaseGroupLastCreated();
            PurchaseGroupSetNameText(PurchaseGroupLastCreated(), libCamp_gv_tS_TechGroupName[lv_index]);
        }