tocom tag method (for Lua 4) or
__tocom metamethod (for Lua 5), LuaCOM first checks if the
table can be describing a variant. A table is a variant if it has a
Type field. This field must have a string that tells how the
Value field of the table must be converted. Possible values
for Type are string, bool, error,
null, currency, decimal, double,
float, int8, uint8, int4, uint4,
int2, uint2, int1, verb+uint1+, int, and
uint. Each corresponds to a variant type.
If the table is not describing a variant, then it may be describing
a date. A table is a date if it has one of those fields: Day,
DayOfWeek, Month, Year, Hour,
Minute, Second, Milliseconds. LuaCOM
initializes the date with the fields that are present; the others
are kept at their default values.
If the table is not a date, LuaCOM converts Lua tables to SAFEARRAY's and
vice-versa. To be converted, Lua tables must be ``array-like'', that
is, all of its elements must be or ``scalars'' or tables of the same
length. These tables must also be ``array-like''. Here are some
samples of how is this conversion done:
| Lua table | Safe Array | |
table = {"name", "phone"} |
|
|
table = {{1,2},{4,9}} |
|
typelib field, an interfacefield , and a coclass field,
and pass those as arguments to the ImplInterfaceFromTypelib API call. If the table
does not have a typelib field, LuaCOM will look for a progid field and
an interface field, and pass those to the ImplInterface API call. Either way,
LuaCOM will pass the returned object to COM.