COM iteration iterable
COM Objects are iterable through the Luart> helper function each(), returning the next method/property in the COM object at each loop iteration.
Each iteration returns two strings, a field name and its type, which can be one of those values :
- "method": the field is a method that can be called.
- "get property": the field is a property that can be get.
- "set property": the field is a property that can be set.
Example
-- Create a FileSystemObject COM component
local fso = sys.COM("Scripting.FileSystemObject")
-- Iterate over it to get its fields
for field, kind in each(fso) do
print(field..":", kind)
end