Skip to main content
Topic: Bug or wrong documentation at nwcItem:HasDuration() (Read 3407 times) previous topic - next topic

Bug or wrong documentation at nwcItem:HasDuration()

The documentation says:

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')
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 ...