LUA: do_import() error: PluginInfo expected, got PluginInfo

Hello
I have written the following code in the script editor:

function factory (params)
	return function ()
		files = C.StringVector();
		files:push_back("/home/eric/test.wav")
		pos = -1
		Editor:do_import(files, Editing.ImportDistinctFiles, Editing.ImportAsTrack, ARDOUR.SrcQuality.SrcBest, pos, ARDOUR.PluginInfo())
	end  --function
end --factory

And I get this error:

LuaException: [string “function factory (params)…”]:6: bad argument #6 to ‘do_import’ (PluginInfo expected, got PluginInfo)

The error is not very clear to me.

Thank you
Eric

This is intricate issue: In short this is fixed in ardour-git (since 5.5-567-gddeaa6c52)

The long story: there is (or was) an ambiguity between the C++ boost::shared_ptr<PluginInfo> and boost::weak_ptr<PluginInfo> . Usually the type is implicit when using arguments. But in case of the constructor: The script created a weak-pointer, the function expected a shared-pointer.

Note that the API for do_import() has changed (allow to import tempo-maps from .mid) in recent git:

    Editor:do_import(files,
    Editing.ImportDistinctFiles, Editing.ImportAsTrack, ARDOUR.SrcQuality.SrcBest,
    ARDOUR.MidiTrackNameSource.SMFTrackName, ARDOUR.MidiTempoMapDisposition.SMFTempoIgnore,
    pos, ARDOUR.PluginInfo())

Thanks for your fix @x42!
I’ll try it asap.
Is arlua included in Ardour daily builds?
I find it useful for debugging.

It works in ardour 5.5.584, thanks