[JW Lua] Determining the current page

Charles O. Lawrence charlesolawrence at bellsouth.net
Mon Oct 21 17:03:33 CEST 2013


Herbert et al,

 

You may find that using the algorithm in a simple function might make your
code easier to write and follow, especially if you need it many times.
Something like this:

 

function isEven(a)

return (a%2) == 0 end

 

-- usage

for x=-10,10 do

    if isEven(x) then

        print(x," is even")

    else

        print(x," is odd")

    end

end

 

Charles

 

 

 

From: JWLua [mailto:jwlua-bounces at jwmusic.nu] On Behalf Of Herbert van Essen
Sent: Monday, October 21, 2013 7:25 AM
To: The JW Lua script plug-in.
Subject: Re: [JW Lua] Determining the current page

 

Thanks very much for the quick answer!








Hartelijke groet,

Herbert
(06-29455445)

 

2013/10/21 Jari Williamsson <jari.williamsson at mailbox.swipnet.se
<mailto:jari.williamsson at mailbox.swipnet.se> >

On 2013-10-21 11:56, Herbert van Essen wrote:

Is it also possible to determine if the page in focus is a left or right
page via the FCUI?

 

AFAIK, the first page is always a right page in Finale, so this should do
it:

isrightpage = (finenv.UI().CurrentPage % 2) ~= 0

(The '%' is modulo in Lua. '~=' is "not equal to" in Lua.)




Best regards,

Jari Williamsson


_______________________________________________
JWLua mailing list
JWLua at jwmusic.nu <mailto:JWLua at jwmusic.nu> 
http://jwmusic.nu/mailman/listinfo/jwlua_jwmusic.nu

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://jwmusic.nu/pipermail/jwlua_jwmusic.nu/attachments/20131021/822b798b/attachment-0002.html>


More information about the JWLua mailing list