Example #1
0
        public LuaTable GetProxyTable(Type type)
        {
            return(_proxyTables.GetOrAdd(type, t =>
            {
                var cache = LuaProxyCache.Get(t);
                var table = new LuaTable();

                foreach (var kv in cache.StaticProperties)
                {
                    // TODO: Implement set.
                    table.NewIndexRaw(kv.Key, LuaObject.FromObject(kv.Value.Info.GetValue(null)));
                }

                foreach (var kv in cache.Methods)
                {
                    table.NewIndexRaw(kv.Key, kv.Value);
                }

                return table;
            }));
        }
Example #2
0
 public LuaProxy(object instance)
 {
     _instance  = instance ?? throw new ArgumentNullException(nameof(instance));
     _cacheItem = LuaProxyCache.Get(instance.GetType());
 }