great. I like the COM feature,
but sometimes it can not work.
use pcall can not catch this error, it just exit without any error report.
for example, following code never ends properly. most time it stop at CircularReference
some "get property" can not be read, luart exit immediately if I try to read some get property.
app = sys.COM("Excel.Application") -- 1.5 can use existing add: , true
app.visible = true
book = app.workbooks:add()
print(book.name)
sheet = book.worksheets:add()
sheet = book.worksheets:add()
sheet = book.worksheets:item(2)
print(sheet.name)
print('-----------------------------')
for field, kind in each(sheet) do
if kind == "get property" then
print(field) end end
print('-----------------------------')
for field, kind in each(sheet) do
if kind == "get property" then
print(field)
print(field, sheet[field]) end end
print('end')
this CircularReference kind error happens at 1.4 and 1.5
and there is some problem at 1.5, which was ok at 1.4,
for example, in another app I have an item, use each() function I know it has a get property named: ItemType
at 1.4, it prints out as 35
at 1.5, luart exit immediately if I try to read it.
at office VBA it is shown as SquareItem enum.
so maybe this is related to newly added COM enumeration feature. some works, some not.