Reallocates the page with a given size. May simply allocate / deallocate space at the end of the file or allocate a new chunk of memory and copy the contents.

Definition

void Resize (int num_rows)

Arguments

  • int num_rows The number of rows to store in the page. Must be greater than 0.

Returns

No return values.

Example

local myPage = Page.New("myPage", 32, {
    Page.Type.String ("Name", 64),
    Page.Type.Number "Score",
    Page.Type.Bool "IsBanned",
})

local numPlayers = 0
local function addPlayer(player)
    if numPlayers == #myPage then
        myPage:Resize(2 * #myPage)
    end

    myPage:Set(numPlayers, {
        Name = "Joe",
        Score = 0,
        IsBanned = true,
    })
    numPlayers = numPlayers + 1
end