Hey Folks,
I'm finally getting my feet wet on JW Lua.
Quick question: On this line:
local onlychangecertainnoteduration=1024
I want to add multiple items, but I can't get it to work. I'm trying
local onlychangecertainnoteduration=1536, 1024, 512
local onlychangecertainnoteduration=1536+1024+512 (this brings Lua in calcu-mode)
local onlychangecertainnoteduration=1536 & 1024 & 512
Could someone give me a hand?
Much appreciated,
A.P.
JW Lua - Multiple Items
Moderators: Peter Thomsen, miker
There are two methods: either check for a range or run through a table which contains all possible values:
Code: Select all
print("Method #1: check whether the duration is within a range")
local SmallestEntryEDU = 1024
local HighestEntryEDU = 2048
for noteentry in eachentrysaved(finenv.Region()) do
if ( noteentry.Duration >= SmallestEntryEDU ) and ( noteentry.Duration <= HighestEntryEDU) then
print( "Entry #", noteentry.EntryNumber , " is within the range" )
end
end
print("")
print("\rMethod #2: check if the duration occurs in a table")
local EntryEDUTable = { 1024, 2048, 4096 }
for noteentry in eachentrysaved(finenv.Region()) do
for key, value in pairs( EntryEDUTable ) do
if ( noteentry.Duration == value ) then
print("Entry #", noteentry.EntryNumber, "'s duration occurs in the table")
end
end
end
Finale 3.0-25.5, German edition, Windows 7
trombonist, pianist, conductor / Recklinghausen, Germany
trombonist, pianist, conductor / Recklinghausen, Germany