[JW Lua] More class questions
Jari Williamsson
jari.williamsson at mailbox.swipnet.se
Thu Aug 29 22:14:31 CEST 2013
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
More information about the JWLua
mailing list