Commit e2fd560d authored by Vinicius Jarina's avatar Vinicius Jarina
Browse files

Fix #45 support for com objects (update with com.lua from @prabirshrestha)

parent 7e8c165a
--require 'luanet'
require 'CLRPackage'
import 'System'
import 'System.Reflection'
local get_flags = luanet.enum(BindingFlags,'GetProperty,IgnoreCase,Public')
......@@ -36,18 +34,11 @@ function com_wrapper(obj)
local T = obj:GetType()
return setmetatable({},{
__index = function(self,key)
local ok,res = pcall(T.InvokeMember,T,key,get_flags,nil,obj,empty)
if not ok then
res = tostring(res)
if res:match 'Member not found' then
return caller(obj,key) --local c =
--~ rawset(self,key,c)
--~ return c
else
error("cannot find "..key,2)
end
else
local ok,res = pcall(T.InvokeMember, T, key, get_flags, nil, obj, empty)
if ok then
return maybe_wrap(res)
else
return caller(obj, key)
end
end;
__newindex = function(self,key,value)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment