COM:constructor(classname, [use_existing])constructor

The COM constructor returns a COM object instance, representing an abstraction of a Windows COM object.

Parameters

classname

A string representing the class name of the Windows COM object. The class name must correspond to a Windows registered COM component.

[use_existing]

An optional boolean, that when set to true, indicates that an already running instance of the COM object will be used. If set to false (the default), the system will create a new instance of the COM object.

When using Luart x64 interpreter, the class may not exists as some Windows COM objects are only 32bits compatible.

Return value

The constructor returns a new COM instance.

Example

local dbname = "data.mdb" -- Create a ADOX.Catalog COM object local cat = sys.COM("ADOX.Catalog") -- Call the "Create" method of ADOX.Catalog object to create a _Connection (another COM Object) to the database file local con = cat:Create("Provider=Microsoft.Jet.OLEDB.4.0;Jet OLEDB:Engine Type=5;Data Source="..dbname)