Skip to content

Return of Reckoning

Wiki

RoR Wiki

API:PageWindowGetNumPages

From RoR Wiki

UI Lua API · PageWindow functions
Version: WAR 1.4.8

Returns the number of pages in a PageWindow.

numPages = PageWindowGetNumPages(pageWindowName)

Arguments

pageWindowName
string – Name of the PageWindow.

Returns

numPages
number – The number of pages, counted the last time the pages were laid out.

Details

  • The value is calculated by PageWindowUpdatePages. It does not change on its own when the content changes.
  • A layout always produces at least one page.

Errors

  • Error in function call 'PageWindowGetNumPages': Window %s does not exist
  • Error in function call 'PageWindowGetNumPages': Window %s is not a PageWindow

Example

From TomeWindow.FlipPageWindowForward in default/ea_tomeofknowledge/source/tomewindow.lua:

local curPage   = PageWindowGetCurrentPage( pageWindow )
local numPages  = PageWindowGetNumPages( pageWindow )
local flipPages = PageWindowGetNumPagesDisplayed( pageWindow )

if( curPage + flipPages > numPages ) then
    return false
end

PageWindowSetCurrentPage( pageWindow, curPage + flipPages )

See also