[JW Lua] More class questions

Charles O. Lawrence charlesolawrence at bellsouth.net
Thu Aug 29 23:26:17 CEST 2013


Thanks for taking the time and having the patience to answer what must seem
like novice questions.

Charles Lawrence

-----Original Message-----
From: JWLua [mailto:jwlua-bounces at jwmusic.nu] On Behalf Of Jari Williamsson
Sent: Thursday, August 29, 2013 4:15 PM
To: The JW Lua script plug-in.
Subject: Re: [JW Lua] More class questions

On 2013-08-29 21:32, Charles O. Lawrence wrote:

> What is it about FCUI that doesn't work?

FCUI is a special class that's only has one single global instance, which is
accessed through "finenv.UI()", such as "finenv.UI():Beep()".

> You said "note" classes can be accessed through an iterator, like in 
> the below test script, or through a collection.  Please show an 
> example of how to access a "note" class property, say "Staff", through 
> a collection.

Here's an example that loads entry data to a FCNoteEntryCell object:

-- Assuming a staff with the id 1 exists in the document...
entrycell = finale.FCNoteEntryCell(1, 1)
-- Load all the frame's visible layers (can
-- be changed by setting the LoadLayerMode)
entrycell:Load()
print (entrycell.Count, "FCNoteEntry object loaded") for myentry in
each(entrycell) do
     -- Do something with the note entry here end


> If an FCNoteEntry is a collection of FCNote objects, how can you 
> access the properties/methods of one of those objects?

To iterate through all notes in each chord and print the displacement value
of each note:
---
for myentry in eachentry(finenv.Region()) do
     for mynote in each(myentry) do
         print (mynote.Displacement)
     end
end
---

> If a property is non-existent, i.e. misspelled, like in e.Visable, no 
> error is generated.  Is this a consequence of the loose typing 
> inherent in Lua?

When you have a R-value that is non-defined, you'll get a "nil" result. 
For example:
v = e.Visable -- misspelled property, setting v to "nil"

But:
e.Visable = true
...gives an syntax error.


Best regards,

Jari Williamsson


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





More information about the JWLua mailing list