NoteWorthy Composer Forum

Forums => Tips & Tricks => User Tools => Topic started by: hmmueller on 2018-05-27 12:10 pm

Title: Bug or wrong documentation at nwcItem:HasDuration()
Post by: hmmueller on 2018-05-27 12:10 pm
The documentation (https://lua.noteworthycomposer.com/usertool/nwcItem.html##(nwcItem).HasDuration) says:

Quote
Hint: grace notes do not have duration.

But the following tool,
Code: [Select · Download]
local f = nwcut.loadFile()
for i = 1, #f.Staff do
  for j = 1, #f.Staff[i].Items do
    local item = f.Staff[i].Items[j]
    nwcut.warn(i ..'/'..j ..' --> '..(item:HasDuration() and 'true' or 'false')..'\n')
  end
end
nwcut.status = nwcut.const.rc_Report
when called on a new staff with two grace notes, outputs
Code: [Select · Download]
1/1 --> true
1/2 --> true

I'll use
Code: [Select · Download]
item:HasDuration() and not item.Opts.Dur.Grace
instead - I think this is what the documentation means ...

H.M.